From 396fe0dd28bd560dbff391bf0212c960df47f0fc Mon Sep 17 00:00:00 2001 From: Matthias Maier Date: Mon, 19 Apr 2021 20:23:51 -0500 Subject: [PATCH] fix a warning MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This fixes a warning emitted by gcc-10.3.0: warning: comparison of unsigned expression in ‘< 0’ is always false [-Wtype-limits] --- source/base/quadrature_lib.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source/base/quadrature_lib.cc b/source/base/quadrature_lib.cc index 0f69c4e9c9..b72c6564f0 100644 --- a/source/base/quadrature_lib.cc +++ b/source/base/quadrature_lib.cc @@ -1203,7 +1203,11 @@ QSimplex::QSimplex(const Quadrature &quad) for (unsigned int i = 0; i < quad.size(); ++i) { double r = 0; - for (unsigned int d = 0; d < dim; ++d) + /* Use "int d" instead of the more natural "unsigned int d" to work + * around a wrong diagnostic in gcc-10.3.0 that warns about that the + * comparison "d < dim" is always false in case of "dim == 0". + * MM 2021 */ + for (int d = 0; d < dim; ++d) r += quad.point(i)[d]; if (r <= 1 + 1e-10) { -- 2.39.5