]> https://gitweb.dealii.org/ - dealii.git/commitdiff
MappingQGeneric: Fix warning about array bounds 12251/head
authorMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Wed, 19 May 2021 10:46:23 +0000 (12:46 +0200)
committerMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Wed, 19 May 2021 10:46:23 +0000 (12:46 +0200)
source/fe/mapping_q_generic.cc

index e8b328364fdd0f891cd5b6d31f15f875bede10e4..1db0f55cba007cb33b785264677a162482dea4af 100644 (file)
@@ -1267,10 +1267,10 @@ MappingQGeneric<dim, spacedim>::fill_mapping_data_for_generic_points(
         Point<dim, VectorizedArray<double>> p_vec;
         for (unsigned int j = 0; j < n_lanes; ++j)
           if (i + j < n_points)
-            for (unsigned int d = 0; d < spacedim; ++d)
+            for (unsigned int d = 0; d < dim; ++d)
               p_vec[d][j] = unit_points[i + j][d];
           else
-            for (unsigned int d = 0; d < spacedim; ++d)
+            for (unsigned int d = 0; d < dim; ++d)
               p_vec[d][j] = unit_points[i][d];
 
         const auto result =
@@ -1288,8 +1288,8 @@ MappingQGeneric<dim, spacedim>::fill_mapping_data_for_generic_points(
 
         if (update_flags & update_jacobians)
           for (unsigned int j = 0; j < n_lanes && i + j < n_points; ++j)
-            for (unsigned int d = 0; d < dim; ++d)
-              for (unsigned int e = 0; e < spacedim; ++e)
+            for (unsigned int d = 0; d < spacedim; ++d)
+              for (unsigned int e = 0; e < dim; ++e)
                 output_data.jacobians[i + j][d][e] = result.second[e][d][j];
 
         if (update_flags & update_inverse_jacobians)
@@ -1299,8 +1299,8 @@ MappingQGeneric<dim, spacedim>::fill_mapping_data_for_generic_points(
             const DerivativeForm<1, spacedim, dim, VectorizedArray<double>>
               inv_jac = jac.covariant_form();
             for (unsigned int j = 0; j < n_lanes && i + j < n_points; ++j)
-              for (unsigned int d = 0; d < spacedim; ++d)
-                for (unsigned int e = 0; e < dim; ++e)
+              for (unsigned int d = 0; d < dim; ++d)
+                for (unsigned int e = 0; e < spacedim; ++e)
                   output_data.inverse_jacobians[i + j][d][e] = inv_jac[d][e][j];
           }
       }
@@ -1327,8 +1327,8 @@ MappingQGeneric<dim, spacedim>::fill_mapping_data_for_generic_points(
           {
             DerivativeForm<1, spacedim, dim> jac(result.second);
             DerivativeForm<1, spacedim, dim> inv_jac = jac.covariant_form();
-            for (unsigned int d = 0; d < spacedim; ++d)
-              for (unsigned int e = 0; e < dim; ++e)
+            for (unsigned int d = 0; d < dim; ++d)
+              for (unsigned int e = 0; e < spacedim; ++e)
                 output_data.inverse_jacobians[i][d][e] = inv_jac[d][e];
           }
       }

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.