diff options
author | Harald Anlauf <anlauf@gmx.de> | 2023-01-25 22:47:26 +0100 |
---|---|---|
committer | Harald Anlauf <anlauf@gmx.de> | 2023-01-26 19:25:44 +0100 |
commit | c8e07c7951421e718bcafbe5924e75c9aa133af9 (patch) | |
tree | 6e9bd75320a3131c383ee6a973b3f29d3a98c765 /gcc/fortran | |
parent | a82ce9c8d155ecda2d1c647d5c588f29e21ef4a3 (diff) | |
download | gcc-c8e07c7951421e718bcafbe5924e75c9aa133af9.zip gcc-c8e07c7951421e718bcafbe5924e75c9aa133af9.tar.gz gcc-c8e07c7951421e718bcafbe5924e75c9aa133af9.tar.bz2 |
Fortran: fix ICE in check_host_association [PR108544]
gcc/fortran/ChangeLog:
PR fortran/108544
* resolve.cc (check_host_association): Extend host association check
so that it is not restricted to functions. Also prevent NULL pointer
dereference.
gcc/testsuite/ChangeLog:
PR fortran/108544
* gfortran.dg/pr108544.f90: New test.
* gfortran.dg/pr96102b.f90: New test.
Diffstat (limited to 'gcc/fortran')
-rw-r--r-- | gcc/fortran/resolve.cc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/fortran/resolve.cc b/gcc/fortran/resolve.cc index 94213cd..9e2edf7 100644 --- a/gcc/fortran/resolve.cc +++ b/gcc/fortran/resolve.cc @@ -6087,7 +6087,6 @@ check_host_association (gfc_expr *e) gfc_find_symbol (e->symtree->name, gfc_current_ns, 1, &sym); if (sym && old_sym != sym - && sym->ts.type == old_sym->ts.type && sym->attr.flavor == FL_PROCEDURE && sym->attr.contained) { @@ -6132,6 +6131,9 @@ check_host_association (gfc_expr *e) return false; } + if (ref == NULL) + return false; + gcc_assert (ref->type == REF_ARRAY); /* Grab the start expressions from the array ref and |