From d0ccf356bd78d30a30137ae8e5ee0c6520becf69 Mon Sep 17 00:00:00 2001 From: tkoenig Date: Wed, 15 Mar 2017 07:45:39 +0000 Subject: 2017-03-15 Thomas Koenig PR libfortran/79956 * libgfortran.h (GFC_ASSERT): New macro. * m4/reshape.m4 (reshape_'rtype_ccode`): Use GFC_ASSERT to specify that sdim > 0 and rdim > 0. * intrinsic/reshape_generic.c (reshape_internal): Likweise. * generated/reshape_c10.c: Regenerated. * generated/reshape_c16.c: Regenerated. * generated/reshape_c4.c: Regenerated. * generated/reshape_c8.c: Regenerated. * generated/reshape_i16.c: Regenerated. * generated/reshape_i4.c: Regenerated. * generated/reshape_i8.c: Regenerated. * generated/reshape_r10.c: Regenerated. * generated/reshape_r16.c: Regenerated. * generated/reshape_r4.c: Regenerated. * generated/reshape_r8.c: Regenerated. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@246153 138bc75d-0d04-0410-961f-82ee72b054a4 --- libgfortran/generated/reshape_c10.c | 9 +++++++++ libgfortran/generated/reshape_c16.c | 9 +++++++++ libgfortran/generated/reshape_c4.c | 9 +++++++++ libgfortran/generated/reshape_c8.c | 9 +++++++++ libgfortran/generated/reshape_i16.c | 9 +++++++++ libgfortran/generated/reshape_i4.c | 9 +++++++++ libgfortran/generated/reshape_i8.c | 9 +++++++++ libgfortran/generated/reshape_r10.c | 9 +++++++++ libgfortran/generated/reshape_r16.c | 9 +++++++++ libgfortran/generated/reshape_r4.c | 9 +++++++++ libgfortran/generated/reshape_r8.c | 9 +++++++++ 11 files changed, 99 insertions(+) (limited to 'libgfortran/generated') diff --git a/libgfortran/generated/reshape_c10.c b/libgfortran/generated/reshape_c10.c index 00c64aeb746..af45e960ee7 100644 --- a/libgfortran/generated/reshape_c10.c +++ b/libgfortran/generated/reshape_c10.c @@ -78,6 +78,10 @@ reshape_c10 (gfc_array_c10 * const restrict ret, index_type shape_data[GFC_MAX_DIMENSIONS]; rdim = GFC_DESCRIPTOR_EXTENT(shape,0); + /* rdim is always > 0; this lets the compiler optimize more and + avoids a potential warning. */ + GFC_ASSERT(sdim>0); + if (rdim != GFC_DESCRIPTOR_RANK(ret)) runtime_error("rank of return array incorrect in RESHAPE intrinsic"); @@ -232,6 +236,11 @@ reshape_c10 (gfc_array_c10 * const restrict ret, } sdim = GFC_DESCRIPTOR_RANK (source); + + /* sdim is always > 0; this lets the compiler optimize more and + avoids a warning. */ + GFC_ASSERT(sdim>0); + ssize = 1; sempty = 0; for (n = 0; n < sdim; n++) diff --git a/libgfortran/generated/reshape_c16.c b/libgfortran/generated/reshape_c16.c index 4d90ce4a6fd..977a53dbe47 100644 --- a/libgfortran/generated/reshape_c16.c +++ b/libgfortran/generated/reshape_c16.c @@ -78,6 +78,10 @@ reshape_c16 (gfc_array_c16 * const restrict ret, index_type shape_data[GFC_MAX_DIMENSIONS]; rdim = GFC_DESCRIPTOR_EXTENT(shape,0); + /* rdim is always > 0; this lets the compiler optimize more and + avoids a potential warning. */ + GFC_ASSERT(sdim>0); + if (rdim != GFC_DESCRIPTOR_RANK(ret)) runtime_error("rank of return array incorrect in RESHAPE intrinsic"); @@ -232,6 +236,11 @@ reshape_c16 (gfc_array_c16 * const restrict ret, } sdim = GFC_DESCRIPTOR_RANK (source); + + /* sdim is always > 0; this lets the compiler optimize more and + avoids a warning. */ + GFC_ASSERT(sdim>0); + ssize = 1; sempty = 0; for (n = 0; n < sdim; n++) diff --git a/libgfortran/generated/reshape_c4.c b/libgfortran/generated/reshape_c4.c index c69696881b4..fd94689a4c0 100644 --- a/libgfortran/generated/reshape_c4.c +++ b/libgfortran/generated/reshape_c4.c @@ -78,6 +78,10 @@ reshape_c4 (gfc_array_c4 * const restrict ret, index_type shape_data[GFC_MAX_DIMENSIONS]; rdim = GFC_DESCRIPTOR_EXTENT(shape,0); + /* rdim is always > 0; this lets the compiler optimize more and + avoids a potential warning. */ + GFC_ASSERT(sdim>0); + if (rdim != GFC_DESCRIPTOR_RANK(ret)) runtime_error("rank of return array incorrect in RESHAPE intrinsic"); @@ -232,6 +236,11 @@ reshape_c4 (gfc_array_c4 * const restrict ret, } sdim = GFC_DESCRIPTOR_RANK (source); + + /* sdim is always > 0; this lets the compiler optimize more and + avoids a warning. */ + GFC_ASSERT(sdim>0); + ssize = 1; sempty = 0; for (n = 0; n < sdim; n++) diff --git a/libgfortran/generated/reshape_c8.c b/libgfortran/generated/reshape_c8.c index e7d9f9dbb1d..6377049397b 100644 --- a/libgfortran/generated/reshape_c8.c +++ b/libgfortran/generated/reshape_c8.c @@ -78,6 +78,10 @@ reshape_c8 (gfc_array_c8 * const restrict ret, index_type shape_data[GFC_MAX_DIMENSIONS]; rdim = GFC_DESCRIPTOR_EXTENT(shape,0); + /* rdim is always > 0; this lets the compiler optimize more and + avoids a potential warning. */ + GFC_ASSERT(sdim>0); + if (rdim != GFC_DESCRIPTOR_RANK(ret)) runtime_error("rank of return array incorrect in RESHAPE intrinsic"); @@ -232,6 +236,11 @@ reshape_c8 (gfc_array_c8 * const restrict ret, } sdim = GFC_DESCRIPTOR_RANK (source); + + /* sdim is always > 0; this lets the compiler optimize more and + avoids a warning. */ + GFC_ASSERT(sdim>0); + ssize = 1; sempty = 0; for (n = 0; n < sdim; n++) diff --git a/libgfortran/generated/reshape_i16.c b/libgfortran/generated/reshape_i16.c index bb5eb6b5506..65576a31704 100644 --- a/libgfortran/generated/reshape_i16.c +++ b/libgfortran/generated/reshape_i16.c @@ -78,6 +78,10 @@ reshape_16 (gfc_array_i16 * const restrict ret, index_type shape_data[GFC_MAX_DIMENSIONS]; rdim = GFC_DESCRIPTOR_EXTENT(shape,0); + /* rdim is always > 0; this lets the compiler optimize more and + avoids a potential warning. */ + GFC_ASSERT(sdim>0); + if (rdim != GFC_DESCRIPTOR_RANK(ret)) runtime_error("rank of return array incorrect in RESHAPE intrinsic"); @@ -232,6 +236,11 @@ reshape_16 (gfc_array_i16 * const restrict ret, } sdim = GFC_DESCRIPTOR_RANK (source); + + /* sdim is always > 0; this lets the compiler optimize more and + avoids a warning. */ + GFC_ASSERT(sdim>0); + ssize = 1; sempty = 0; for (n = 0; n < sdim; n++) diff --git a/libgfortran/generated/reshape_i4.c b/libgfortran/generated/reshape_i4.c index 597b0cb70d2..d07b3a9c2d1 100644 --- a/libgfortran/generated/reshape_i4.c +++ b/libgfortran/generated/reshape_i4.c @@ -78,6 +78,10 @@ reshape_4 (gfc_array_i4 * const restrict ret, index_type shape_data[GFC_MAX_DIMENSIONS]; rdim = GFC_DESCRIPTOR_EXTENT(shape,0); + /* rdim is always > 0; this lets the compiler optimize more and + avoids a potential warning. */ + GFC_ASSERT(sdim>0); + if (rdim != GFC_DESCRIPTOR_RANK(ret)) runtime_error("rank of return array incorrect in RESHAPE intrinsic"); @@ -232,6 +236,11 @@ reshape_4 (gfc_array_i4 * const restrict ret, } sdim = GFC_DESCRIPTOR_RANK (source); + + /* sdim is always > 0; this lets the compiler optimize more and + avoids a warning. */ + GFC_ASSERT(sdim>0); + ssize = 1; sempty = 0; for (n = 0; n < sdim; n++) diff --git a/libgfortran/generated/reshape_i8.c b/libgfortran/generated/reshape_i8.c index 53e35d2c529..f48728d17be 100644 --- a/libgfortran/generated/reshape_i8.c +++ b/libgfortran/generated/reshape_i8.c @@ -78,6 +78,10 @@ reshape_8 (gfc_array_i8 * const restrict ret, index_type shape_data[GFC_MAX_DIMENSIONS]; rdim = GFC_DESCRIPTOR_EXTENT(shape,0); + /* rdim is always > 0; this lets the compiler optimize more and + avoids a potential warning. */ + GFC_ASSERT(sdim>0); + if (rdim != GFC_DESCRIPTOR_RANK(ret)) runtime_error("rank of return array incorrect in RESHAPE intrinsic"); @@ -232,6 +236,11 @@ reshape_8 (gfc_array_i8 * const restrict ret, } sdim = GFC_DESCRIPTOR_RANK (source); + + /* sdim is always > 0; this lets the compiler optimize more and + avoids a warning. */ + GFC_ASSERT(sdim>0); + ssize = 1; sempty = 0; for (n = 0; n < sdim; n++) diff --git a/libgfortran/generated/reshape_r10.c b/libgfortran/generated/reshape_r10.c index 923174dd4e2..a5722d4244f 100644 --- a/libgfortran/generated/reshape_r10.c +++ b/libgfortran/generated/reshape_r10.c @@ -78,6 +78,10 @@ reshape_r10 (gfc_array_r10 * const restrict ret, index_type shape_data[GFC_MAX_DIMENSIONS]; rdim = GFC_DESCRIPTOR_EXTENT(shape,0); + /* rdim is always > 0; this lets the compiler optimize more and + avoids a potential warning. */ + GFC_ASSERT(sdim>0); + if (rdim != GFC_DESCRIPTOR_RANK(ret)) runtime_error("rank of return array incorrect in RESHAPE intrinsic"); @@ -232,6 +236,11 @@ reshape_r10 (gfc_array_r10 * const restrict ret, } sdim = GFC_DESCRIPTOR_RANK (source); + + /* sdim is always > 0; this lets the compiler optimize more and + avoids a warning. */ + GFC_ASSERT(sdim>0); + ssize = 1; sempty = 0; for (n = 0; n < sdim; n++) diff --git a/libgfortran/generated/reshape_r16.c b/libgfortran/generated/reshape_r16.c index 136d4f69b7e..c56b8717a83 100644 --- a/libgfortran/generated/reshape_r16.c +++ b/libgfortran/generated/reshape_r16.c @@ -78,6 +78,10 @@ reshape_r16 (gfc_array_r16 * const restrict ret, index_type shape_data[GFC_MAX_DIMENSIONS]; rdim = GFC_DESCRIPTOR_EXTENT(shape,0); + /* rdim is always > 0; this lets the compiler optimize more and + avoids a potential warning. */ + GFC_ASSERT(sdim>0); + if (rdim != GFC_DESCRIPTOR_RANK(ret)) runtime_error("rank of return array incorrect in RESHAPE intrinsic"); @@ -232,6 +236,11 @@ reshape_r16 (gfc_array_r16 * const restrict ret, } sdim = GFC_DESCRIPTOR_RANK (source); + + /* sdim is always > 0; this lets the compiler optimize more and + avoids a warning. */ + GFC_ASSERT(sdim>0); + ssize = 1; sempty = 0; for (n = 0; n < sdim; n++) diff --git a/libgfortran/generated/reshape_r4.c b/libgfortran/generated/reshape_r4.c index b73a96816f2..889813c07ec 100644 --- a/libgfortran/generated/reshape_r4.c +++ b/libgfortran/generated/reshape_r4.c @@ -78,6 +78,10 @@ reshape_r4 (gfc_array_r4 * const restrict ret, index_type shape_data[GFC_MAX_DIMENSIONS]; rdim = GFC_DESCRIPTOR_EXTENT(shape,0); + /* rdim is always > 0; this lets the compiler optimize more and + avoids a potential warning. */ + GFC_ASSERT(sdim>0); + if (rdim != GFC_DESCRIPTOR_RANK(ret)) runtime_error("rank of return array incorrect in RESHAPE intrinsic"); @@ -232,6 +236,11 @@ reshape_r4 (gfc_array_r4 * const restrict ret, } sdim = GFC_DESCRIPTOR_RANK (source); + + /* sdim is always > 0; this lets the compiler optimize more and + avoids a warning. */ + GFC_ASSERT(sdim>0); + ssize = 1; sempty = 0; for (n = 0; n < sdim; n++) diff --git a/libgfortran/generated/reshape_r8.c b/libgfortran/generated/reshape_r8.c index d35a8c92e36..279f89dcf2c 100644 --- a/libgfortran/generated/reshape_r8.c +++ b/libgfortran/generated/reshape_r8.c @@ -78,6 +78,10 @@ reshape_r8 (gfc_array_r8 * const restrict ret, index_type shape_data[GFC_MAX_DIMENSIONS]; rdim = GFC_DESCRIPTOR_EXTENT(shape,0); + /* rdim is always > 0; this lets the compiler optimize more and + avoids a potential warning. */ + GFC_ASSERT(sdim>0); + if (rdim != GFC_DESCRIPTOR_RANK(ret)) runtime_error("rank of return array incorrect in RESHAPE intrinsic"); @@ -232,6 +236,11 @@ reshape_r8 (gfc_array_r8 * const restrict ret, } sdim = GFC_DESCRIPTOR_RANK (source); + + /* sdim is always > 0; this lets the compiler optimize more and + avoids a warning. */ + GFC_ASSERT(sdim>0); + ssize = 1; sempty = 0; for (n = 0; n < sdim; n++) -- cgit v1.2.1