@@ -66,6 +66,7 @@ reshape_internal (parray *ret, parray *source, shape_type *shape,
index_type shape_data[GFC_MAX_DIMENSIONS];
rdim = GFC_DESCRIPTOR_EXTENT(shape,0);
+ GFC_ASSERT(rdim>0);
if (rdim != GFC_DESCRIPTOR_RANK(ret))
runtime_error("rank of return array incorrect in RESHAPE intrinsic");
@@ -158,6 +159,10 @@ reshape_internal (parray *ret, parray *source, shape_type *shape,
source_extent = 1;
sdim = GFC_DESCRIPTOR_RANK (source);
+ /* sdim is always > 0; this lets the compiler optimize more and
+ avoids a warning. */
+ GFC_ASSERT(sdim>0);
+
for (n = 0; n < sdim; n++)
{
index_type se;
@@ -219,6 +224,7 @@ reshape_internal (parray *ret, parray *source, shape_type *shape,
}
sdim = GFC_DESCRIPTOR_RANK (source);
+ GFC_ASSERT(sdim>0);
ssize = 1;
sempty = 0;
for (n = 0; n < sdim; n++)