patch, libfortran] [patch, fortran] Fix PR 79956, part two, attempt 3

Submitted by Markus Trippelsdorf on March 17, 2017, 4:48 p.m.

Details

Message ID 20170317164825.GA292@x4
State New
Headers show

Commit Message

Markus Trippelsdorf March 17, 2017, 4:48 p.m.
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:

Comments

Thomas Koenig March 17, 2017, 9:29 p.m.
Am 17.03.2017 um 17:48 schrieb Markus Trippelsdorf:
> You should use rdim not sdim in the GFC_ASSERT.

Fixed in rev 246248.

Sorry for the breakage.

	Thomas

Patch hide | download patch | download mbox

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