From a964d4b12be9d8ed027b5faa3f3c439eff08ef16 Mon Sep 17 00:00:00 2001 From: Paul Thomas Date: Tue, 28 Nov 2017 15:13:42 +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: r255202 --- gcc/fortran/ChangeLog | 7 +++++++ gcc/fortran/resolve.c | 6 +++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 7ba781447f9..91c57e0d43d 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,10 @@ +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-28 Jakub Jelinek * trans-decl.c (gfc_trans_entry_master_switch): Build SWITCH_EXPR diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 9a814017c36..fe2f43a1e57 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -13502,7 +13502,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. */ -- 2.30.2