Dear Tobias, all,

> The reason that it is not permitted is the "automatic data object"
> (see *...* highlighted parts in the quote):
>
> C876   (R839) A *variable* whose *designator* appears as a
> *data-stmt-object* or a data-i-do-object hall not be a
> dummy argument, accessed by use or host association,
> in a named common block unless the DATA statement is
> in a block data program unit, in blank common, a function name,
> a function result name, an *automatic* *data* *object,*
> or an allocatable variable.
>
> With the definition: "3.11 automatic data object
> nondummy data object with a type parameter or array bound that
> depends on the value of aspecification-expr that is not
> a constant expression (8.3)"

inspired by Tobias' (although invalid) code example I found another
testcase which lead to trouble during error recovery due to a NULL
pointer dereference.  Here's the updated changelog for the updated
patch (attached).  I also renamed the first testcase so that they
fit better to the existing scheme.

Again regtested on x86_64-pc-linux-gnu.  Now OK for mainline / 10?

Thanks,
Harald


PR fortran/99205 - Out of memory with undefined character length

A character variable appearing as a data statement object cannot
be automatic, thus it shall have constant length.

gcc/fortran/ChangeLog:

        PR fortran/99205
        * data.c (gfc_assign_data_value): Reject non-constant character
        length for lvalue.
        * trans-array.c (gfc_conv_array_initializer): Restrict loop to
        elements which are defined to avoid NULL pointer dereference.

gcc/testsuite/ChangeLog:

        PR fortran/99205
        * gfortran.dg/data_char_4.f90: New test.
        * gfortran.dg/data_char_5.f90: New test.

Attachment: pr99205.patch-v2
Description: Binary data

Reply via email to