[PATCH, v3] PR fortran/103411 - ICE in gfc_conv_array_initializer, at fortran/trans-array.c:6377

Harald Anlauf anlauf@gmx.de
Fri Nov 26 20:07:49 GMT 2021


Hi Mikael,

> Gesendet: Freitag, 26. November 2021 um 15:45 Uhr
> Von: "Mikael Morin" <morin-mikael@orange.fr>
> An: "Harald Anlauf" <anlauf@gmx.de>, fortran@gcc.gnu.org
> Cc: gcc-patches@gcc.gnu.org
> Betreff: Re: [PATCH, v2] PR fortran/103411 - ICE in gfc_conv_array_initializer, at fortran/trans-array.c:6377
>
> Le 25/11/2021 à 22:52, Harald Anlauf a écrit :
>  >
>  > Motivated by your reasoning I tried gfc_reduce_init_expr.  That attempt
>  > failed miserably (many regressions), and I think it is not right.
> 
>  > Then I found that array sections posed a problem that wasn't detected
>  > before.  gfc_simplify_expr seemed to be a better choice that makes more
>  > sense for the present situations and seems to work here.  And it even
>  > detects many more invalid cases now than e.g. Intel ;-)
>  >
> Great let’s go with that.
> Can you set shape_is_constant just after the simplification?
> That is
> 
>    gfc_simplify_expr (shape, 0);
>    if (gfc_is_constant_expr (shape))
>      shape_is_const = true;
> 
>    if (shape->expr_type == EXPR_ARRAY && shape_is_const)
>      ...
> 
> 
> This removes the need for multiple case initialization of shape_is_const 
> which I overlooked in my previous review.
> 
> And the EXPR_ARRAY vs EXPR_VARIABLE change becomes unneeded because the 
> simplification should produce an EXPR_ARRAY.

ah, I did not expect that.  And indeed it seems to do the job!  Furthermore
it turns out that the new patch (v3) removes more code than it adds. :-)

I extended the testcase slightly and regtested again.

That should hopefully be the final version...

Thanks for the really constructive comments!

Harald

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Fortran-improve-check-of-arguments-to-the-RESHAPE-in.patch.v3
Type: application/octet-stream
Size: 6224 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20211126/b6e7af52/attachment-0001.obj>


More information about the Gcc-patches mailing list