]> gcc.gnu.org Git - gcc.git/commit
fortran: ICE using undeclared symbol in array constructor PR93484
authorMark Eggleston <markeggleston@gcc.gnu.org>
Wed, 25 Mar 2020 15:10:03 +0000 (15:10 +0000)
committerJakub Jelinek <jakub@redhat.com>
Thu, 17 Sep 2020 15:39:57 +0000 (17:39 +0200)
commita60e16f2c28ed853da109e9266243c388a6a512f
tree83266666c0f5c153b8976235c18f0e2fbb22427e
parent678d460d865f293526dcc25c9c99e29e8aa9e962
fortran: ICE using undeclared symbol in array constructor PR93484

Using undeclared symbol k in an expression in the following
array constructor results in an ICE:

    print *, [real(x(k))]

If the call to the intrinsic is not in a constructor a no IMPLICIT
type error is reported and the ICE does not occur.

Matching on an expression instead of an initialisation express an
and not converting a MATCH_ERROR return value into MATCH_NO results
in the no IMPLICIT error and no ICE.

Note: Steven G. Kargl  <kargl@gcc.gnu.org> is the author of the
changes except for the test cases.

gcc/fortran/ChangeLog:

Backport from master
2020-03-25  Mark Eggleston <markeggleston@gcc.gnu.org>

PR fortran/93484
* match.c (gfc_match_type_spec): Replace gfc_match_init_expr with
gfc_match_expr. Return m if m is MATCH_NO or MATCH_ERROR.

gcc/testsuite

Backport from master
2020-03-25  Mark Eggleston <markeggleston@gcc.gnu.org>

PR fortran/93484
* gfortran.dg/pr93484_1.f90: New test.
* gfortran.dg/pr93484_2.f90: New test.
gcc/fortran/ChangeLog
gcc/fortran/match.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/pr93484_1.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/pr93484_2.f90 [new file with mode: 0644]
This page took 0.073274 seconds and 6 git commands to generate.