From a82d7ade2db20688de64333826c0b2c8cfe86d85 Mon Sep 17 00:00:00 2001 From: Paul Thomas Date: Tue, 28 Nov 2017 15:38:55 +0000 Subject: [PATCH] re PR fortran/83021 (gfortran segfault in polymorphic assignment) 2017-11-28 Paul Thomas PR fortran/83021 * resolve.c (resolve_component): Only escape for use assciated vtypes if the current namespace has no proc_name and is most particularly block data. From-SVN: r255205 --- gcc/fortran/ChangeLog | 9 ++++++++- gcc/fortran/resolve.c | 6 +++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 2a04635ee6d..dd0bce003c6 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,4 +1,11 @@ -017-11-23 Paul Thomas +2017-11-28 Paul Thomas + + PR fortran/83021 + * resolve.c (resolve_component): Only escape for use assciated + vtypes if the current namespace has no proc_name and is most + particularly block data. + +2017-11-23 Paul Thomas Backported from trunk diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 840f4fbcfb8..4ef7abdea2d 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -13301,7 +13301,11 @@ resolve_component (gfc_component *c, gfc_symbol *sym) if (c->attr.artificial) return true; - if (sym->attr.vtype && sym->attr.use_assoc) + /* Do not allow vtype components to be resolved in nameless namespaces + such as block data because the procedure pointers will cause ICEs + and vtables are not needed in these contexts. */ + if (sym->attr.vtype && sym->attr.use_assoc + && sym->ns->proc_name == NULL) return true; /* F2008, C442. */