aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/resolve.c
diff options
context:
space:
mode:
authorHarald Anlauf <anlauf@gmx.de>2021-01-14 19:21:05 +0100
committerHarald Anlauf <anlauf@gmx.de>2021-01-14 19:21:05 +0100
commit9e1e6e631045c7eed2c72738b7084986d39ca09f (patch)
tree2c8dfbbb8273e38837973ddb149cc486361a5403 /gcc/fortran/resolve.c
parentc1a2cf88059fd9f709df507301d98a19f4c5b42b (diff)
downloadgcc-9e1e6e631045c7eed2c72738b7084986d39ca09f.zip
gcc-9e1e6e631045c7eed2c72738b7084986d39ca09f.tar.gz
gcc-9e1e6e631045c7eed2c72738b7084986d39ca09f.tar.bz2
PR fortran/98661 - valgrind issues with error recovery
During error recovery after an invalid derived type specification it was possible to try to resolve an invalid array specification. We now skip this if the component has the ALLOCATABLE or POINTER attribute and the shape is not deferred. gcc/fortran/ChangeLog: PR fortran/98661 * resolve.c (resolve_component): Derived type components with ALLOCATABLE or POINTER attribute shall have a deferred shape. gcc/testsuite/ChangeLog: PR fortran/98661 * gfortran.dg/pr98661.f90: New test.
Diffstat (limited to 'gcc/fortran/resolve.c')
-rw-r--r--gcc/fortran/resolve.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index f243bd1..ab7ffc2 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -14723,6 +14723,10 @@ resolve_component (gfc_component *c, gfc_symbol *sym)
&& sym != c->ts.u.derived)
add_dt_to_dt_list (c->ts.u.derived);
+ if (c->as && c->as->type != AS_DEFERRED
+ && (c->attr.pointer || c->attr.allocatable))
+ return false;
+
if (!gfc_resolve_array_spec (c->as,
!(c->attr.pointer || c->attr.proc_pointer
|| c->attr.allocatable)))