From 5d4e9f7beed5ad5808cabc615b00316bd9dfe92c Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Mon, 2 Jul 2018 08:00:47 +0000 Subject: [PATCH] re PR lto/86321 (ICE: in splice_child_die, at dwarf2out.c:5693 for several Fortran tests with -g -flto) 2018-07-02 Richard Biener PR lto/86321 * trans-types.c (gfc_get_array_type_bounds): Unshare TYPE_FIELDs for the distinct type copy. From-SVN: r262301 --- gcc/fortran/ChangeLog | 6 ++++++ gcc/fortran/trans-types.c | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index b8e71975672..ac4a2374fe5 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2018-07-02 Richard Biener + + PR lto/86321 + * trans-types.c (gfc_get_array_type_bounds): Unshare TYPE_FIELDs + for the distinct type copy. + 2018-07-02 Paul Thomas PR fortran/82969 diff --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c index f50eb0a9f01..5b396236f85 100644 --- a/gcc/fortran/trans-types.c +++ b/gcc/fortran/trans-types.c @@ -1923,6 +1923,14 @@ gfc_get_array_type_bounds (tree etype, int dimen, int codimen, tree * lbound, base_type = gfc_get_array_descriptor_base (dimen, codimen, restricted); fat_type = build_distinct_type_copy (base_type); + /* Unshare TYPE_FIELDs. */ + for (tree *tp = &TYPE_FIELDS (fat_type); *tp; tp = &DECL_CHAIN (*tp)) + { + tree next = DECL_CHAIN (*tp); + *tp = copy_node (*tp); + DECL_CONTEXT (*tp) = fat_type; + DECL_CHAIN (*tp) = next; + } /* Make sure that nontarget and target array type have the same canonical type (and same stub decl for debug info). */ base_type = gfc_get_array_descriptor_base (dimen, codimen, false); -- 2.30.2