ping

On 20/07/2020 08:27, Mark Eggleston wrote:
Please find attached a fix for PR53298.

This appears to be a very simple fix, however, since it involves structures I'm unfamiliar with I think it needs checking.

When the gfc_ref structure is created for a (1:) substring it has an expression for start and a NULL for the end.  For (:5) the start expression is NULL, a new expression structure is created and assigned to start.  If the end expression is missing a new expression structure is not created, I would've expected an expression  for the missing end to be created but don't know how it should be populated.

When the gfc_ref structure is processed in gfc_walk_array_ref two gfc_ss structures are created, one for the start expression and one for the end expression.  For (1:) the end expression is NULL and will lead to the ICE.  I added a check for the end expression being NULL and if so a gfc_ss structure is not created for substring end.  I did not expect the change to work but it did.

The patch has been tested on x98_64 using make check-fortran.

If OK I can commit to master and backport.

Fortran  : ICE in gfc_conv_scalarized_array_ref PR53298

When an array of characters is an argument to a subroutine and
is accessed using (:)(1:) an ICE occurs.  The upper bound of the
substring does not have an expression and such should not have
a Scalarization State structure added to the Scalarization State
chain.

2020-07-20  Mark Eggleston <markeggles...@gcc.gnu.org>

gcc/fortran/

    PR fortran/53298
    * trans-array.c (gfc_walk_array_ref): If ref->ss.end is set
    call gfc_get_scalar_ss.

2020-07-20  Mark Eggleston <markeggles...@gcc.gnu.org>

gcc/testsuite/

    PR fortran/53298
    * gfortran.dg/pr53298.f90: New test.

--
https://www.codethink.co.uk/privacy.html

Reply via email to