diff options
author | Mark Eggleston <markeggleston@gcc.gnu.org> | 2020-04-02 07:18:52 +0100 |
---|---|---|
committer | Mark Eggleston <markeggleston@gcc.gnu.org> | 2020-04-02 07:18:52 +0100 |
commit | bf1f6d8819ade074271df718f01fd3a5a9dc1b82 (patch) | |
tree | da80262a122d9ff118c64fbc693ce5cd75223ffe /gcc/fortran | |
parent | 25839b6af9f10b3227719db35b9e9e38320341e7 (diff) | |
download | gcc-bf1f6d8819ade074271df718f01fd3a5a9dc1b82.zip gcc-bf1f6d8819ade074271df718f01fd3a5a9dc1b82.tar.gz gcc-bf1f6d8819ade074271df718f01fd3a5a9dc1b82.tar.bz2 |
fortran: ICE equivalence with an element of an array PR94030
Deferred size arrays can not be used in equivalance statements.
gcc/fortran/ChangeLog:
PR fortran/94030
* resolve.c (resolve_equivalence): Correct formatting
around the label "identical_types". Instead of using
gfc_resolve_array_spec use is_non_constants_shape_array
to determine whether the array can be used in a in an
equivalence statement.
gcc/testsuite/ChangeLog:
PR fortran/94030
* gfortran.dg/pr94030_1.f90
* gfortran.dg/pr94030_2.f90
Diffstat (limited to 'gcc/fortran')
-rw-r--r-- | gcc/fortran/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/fortran/resolve.c | 6 |
2 files changed, 12 insertions, 3 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 2539e51..1aa71d8 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,12 @@ +2020-04-02 Steven G. Kargl <kargl@gcc.gnu.org> + + PR fortran/94030 + * resolve.c (resolve_equivalence): Correct formatting + around the label "identical_types". Instead of using + gfc_resolve_array_spec use is_non_constants_shape_array + to determine whether the array can be used in a in an + equivalence statement. + 2020-04-01 Mark Eggleston <mark.eggleston@codethink.com> PR fortran/94386 diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index b6277d2..79b0d72 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -16873,7 +16873,8 @@ resolve_equivalence (gfc_equiv *eq) && !gfc_notify_std (GFC_STD_GNU, msg, sym->name, &e->where)) continue; - identical_types: +identical_types: + last_ts =&sym->ts; last_where = &e->where; @@ -16881,8 +16882,7 @@ resolve_equivalence (gfc_equiv *eq) continue; /* Shall not be an automatic array. */ - if (e->ref->type == REF_ARRAY - && !gfc_resolve_array_spec (e->ref->u.ar.as, 1)) + if (e->ref->type == REF_ARRAY && is_non_constant_shape_array (sym)) { gfc_error ("Array %qs at %L with non-constant bounds cannot be " "an EQUIVALENCE object", sym->name, &e->where); |