]> https://gitweb.dealii.org/ - dealii.git/commitdiff
fix array bounds warning 11634/head
authorTimo Heister <timo.heister@gmail.com>
Tue, 26 Jan 2021 18:47:24 +0000 (13:47 -0500)
committerTimo Heister <timo.heister@gmail.com>
Tue, 26 Jan 2021 18:50:07 +0000 (13:50 -0500)
source/fe/mapping_fe_field.cc

index 0cad06d6f430a8d41331b9a9eff468ab137f4974..1d6cff0836fa8992f9326c9406eba8360ac61038 100644 (file)
@@ -1571,9 +1571,15 @@ MappingFEField<dim, spacedim, VectorType, void>::fill_fe_values(
                   if (dim == 1)
                     output_data.normal_vectors[point] =
                       cross_product_2d(-DX_t[0]);
-                  else // dim == 2
-                    output_data.normal_vectors[point] =
-                      cross_product_3d(DX_t[0], DX_t[1]);
+                  else
+                    {
+                      Assert(dim == 2, ExcInternalError());
+
+                      // dim-1==1 for the second argument, but this
+                      // avoids a compiler warning about array bounds:
+                      output_data.normal_vectors[point] =
+                        cross_product_3d(DX_t[0], DX_t[dim - 1]);
+                    }
 
                   output_data.normal_vectors[point] /=
                     output_data.normal_vectors[point].norm();

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.