[Patch, fortran] PR88247 - [8/9 Regression] ICE in get_array_ctor_var_strlen, at fortran/trans-array.c:2068

Paul Richard Thomas paul.richard.thomas@gmail.com
Sun Mar 24 16:49:00 GMT 2019


This one started with a simple enough testscase and then evolved as I
found out how little actually worked. All the changes in the patch
involve gathering up the string length by hook or by crook.

It will be noted that associate (y => x%d(:)(2:4)) still does not work
correctly. The associate name is correctly formed with the right
values of element length and span. However, it is unusable because the
array indexing uses the element length as the span. I did not want to
touch array indexing at this stage of 9-branch.

Bootstraps and regtests on FC29/x86_64 - OK for 8- and 9-branches?

Paul

2019-03-24  Paul Thomas  <pault@gcc.gnu.org>

    PR fortran/88247
    * expr.c (is_subref_array): Permit substrings to be detected
    as subref arrays.
    * trans-array.c (get_array_ctor_var_strlen): Obtain the length
    of deferred length strings. Handle substrings with a NULL end
    expression.
    (trans_array_constructor): Remove an unnecessary blank line.
    (gfc_conv_scalarized_array_ref): Skip to label 'done' if 'decl'
    is a pointer array.
    (get_array_charlen): If the expression is an array, convert the
    first element of the constructor and use its string length. Get
    a new charlen if necessary.
    (gfc_conv_expr_descriptor): Call 'get_array_charlen' for array
    constructor expressions. If the ss_info string length is
    available, use that to set the span of character arrays.
    * trans-expr.c (gfc_get_expr_charlen): Handle substrings
    * trans-stmt.c (trans_associate_var): Set the pointer array
    flag for variable targets and constant array constructors. Take
    care not to reset the string length or the span in the case of
    expressions that are not converted as direct by reference.

2019-03-24  Paul Thomas  <pault@gcc.gnu.org>

    PR fortran/88247
    * gfortran.dg/associate_47.f90: New test.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: submit.diff
Type: text/x-patch
Size: 12474 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20190324/503ed4e2/attachment.bin>


More information about the Gcc-patches mailing list