]> https://gitweb.dealii.org/ - dealii.git/commitdiff
fix a warning 12061/head
authorMatthias Maier <tamiko@43-1.org>
Tue, 20 Apr 2021 01:23:51 +0000 (20:23 -0500)
committerMatthias Maier <tamiko@43-1.org>
Tue, 20 Apr 2021 03:47:12 +0000 (22:47 -0500)
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

index 0f69c4e9c9b743076eedbc92f3d10a949aca1887..b72c6564f078fb289fc840aa953c621b399c0620 100644 (file)
@@ -1203,7 +1203,11 @@ QSimplex<dim>::QSimplex(const Quadrature<dim> &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)
         {

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.