From: Timo Heister Date: Tue, 26 Jan 2021 18:47:24 +0000 (-0500) Subject: fix array bounds warning X-Git-Tag: v9.3.0-rc1~560^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F11634%2Fhead;p=dealii.git fix array bounds warning --- diff --git a/source/fe/mapping_fe_field.cc b/source/fe/mapping_fe_field.cc index 0cad06d6f4..1d6cff0836 100644 --- a/source/fe/mapping_fe_field.cc +++ b/source/fe/mapping_fe_field.cc @@ -1571,9 +1571,15 @@ MappingFEField::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();