diff --git a/src/OpenFOAM/containers/Lists/List/List.C b/src/OpenFOAM/containers/Lists/List/List.C index 302529f81fb598fb65350e19f792630f1bd219c9..68f0c6440bd134de7cf754103e3c5f271b0df983 100644 --- a/src/OpenFOAM/containers/Lists/List/List.C +++ b/src/OpenFOAM/containers/Lists/List/List.C @@ -50,6 +50,7 @@ void Foam::List<T>::doResize(const label newSize) { if (newSize > 0) { + // With sign-check to avoid spurious -Walloc-size-larger-than T* nv = new T[newSize]; const label overlap = min(this->size_, newSize); diff --git a/src/OpenFOAM/containers/Lists/List/ListI.H b/src/OpenFOAM/containers/Lists/List/ListI.H index a7b0aca30c5aa85fa09512a73bd97878e852984f..650afea8c1ff1226a21d7a990c408516729e8629 100644 --- a/src/OpenFOAM/containers/Lists/List/ListI.H +++ b/src/OpenFOAM/containers/Lists/List/ListI.H @@ -31,8 +31,9 @@ License template<class T> inline void Foam::List<T>::doAlloc() { - if (this->size_) + if (this->size_ > 0) { + // With sign-check to avoid spurious -Walloc-size-larger-than this->v_ = new T[this->size_]; } } diff --git a/src/OpenFOAM/matrices/Matrix/MatrixI.H b/src/OpenFOAM/matrices/Matrix/MatrixI.H index 6d96f4c0e4ddead2e03c554eaed4bae328e012ba..2dc069a6f56c32db223bcfeccc8e942276174e8a 100644 --- a/src/OpenFOAM/matrices/Matrix/MatrixI.H +++ b/src/OpenFOAM/matrices/Matrix/MatrixI.H @@ -35,8 +35,9 @@ inline void Foam::Matrix<Form, Type>::doAlloc() { const label len = size(); - if (len) + if (len > 0) { + // With sign-check to avoid spurious -Walloc-size-larger-than v_ = new Type[len]; } } diff --git a/wmake/rules/linux64Mingw/c++ b/wmake/rules/linux64Mingw/c++ index aebb7a88312a9872d179a6f17ca74439f4f8f34f..4aad3937215a78d2493388a38782a0cb8694147e 100644 --- a/wmake/rules/linux64Mingw/c++ +++ b/wmake/rules/linux64Mingw/c++ @@ -9,7 +9,7 @@ include $(RULES)/c++$(WM_COMPILE_OPTION) c++FLAGS = $(c++ARCH) $(GFLAGS) $(c++WARN) $(c++OPT) $(c++DBUG) $(ptFLAGS) $(LIB_HEADER_DIRS) -Ctoo = $(WM_SCHEDULER) $(CC) $(c++FLAGS) -Wno-alloc-size-larger-than -c $< -o $@ +Ctoo = $(WM_SCHEDULER) $(CC) $(c++FLAGS) -c $< -o $@ cxxtoo = $(Ctoo) cctoo = $(Ctoo) cpptoo = $(Ctoo)