[Patch, fortran] PR96624 - A segment fault occurred when using the reshape function result to assign a variable

Tobias Burnus tobias@codesourcery.com
Thu Aug 27 07:46:22 GMT 2020


Looks good to me.

Thanks for the patch!

Tobias

On 8/27/20 8:17 AM, Paul Richard Thomas via Fortran wrote:
> Hi All,
>
> Here is another of Steve Kargl's patches.
>
> Before the patch is applied, the following code is generated:
>      atmp.0.span = 4;
>      atmp.0.data = 0B;
>      atmp.0.offset = 0;
>      (*(integer(kind=4)[0] * restrict) atmp.0.data)[0] = 1;
>      (*(integer(kind=4)[0] * restrict) atmp.0.data)[1] = 2;
>
> which causes a segfault at run time. The test case counts the number of
> occurrences of 'data' to check that the bad assignments have gone.
>
> Regtests OK on FC31/x86_64 - OK for aster?
>
> This patch fixes PR96624.
>
> 2020-08-27  Paul Thomas  <pault@gcc.gnu.org>
>
> gcc/fortran
> PR fortran/96624
> * simplify.c (gfc_simplify_reshape): Detect zero shape and
> clear index if found.
>
> gcc/testsuite/
> PR fortran/96624
> * gfortran.dg/reshape_8.f90 : New test.
-----------------
Mentor Graphics (Deutschland) GmbH, Arnulfstraße 201, 80634 München / Germany
Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Alexander Walter


More information about the Gcc-patches mailing list