On 2017.03.15 at 00:01 +0100, Thomas Koenig wrote:
> Hello world,
> 
> well, here is the third attempt at fixing the second part of the PR.
> Glancing over the source, I think there are quite a few places where
> we currently issue a runtime error which we could replace by an
> assert, but that's something for 8.0.
> 
> Regression-tested on x86_64-pc-linux-gnu.

> Index: generated/reshape_c10.c
> ===================================================================
> --- generated/reshape_c10.c   (Revision 245760)
> +++ generated/reshape_c10.c   (Arbeitskopie)
> @@ -232,6 +232,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);
> +

You have committed a different patch, which is obviously wrong:

diff --git a/libgfortran/generated/reshape_c10.c 
b/libgfortran/generated/reshape_c10.c
index 00c64aeb746f..af45e960ee7f 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);

You should use rdim not sdim in the GFC_ASSERT.

-- 
Markus

Reply via email to