re PR lto/86321 (ICE: in splice_child_die, at dwarf2out.c:5693 for several Fortran...
authorRichard Biener <rguenther@suse.de>
Mon, 2 Jul 2018 08:00:47 +0000 (08:00 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Mon, 2 Jul 2018 08:00:47 +0000 (08:00 +0000)
2018-07-02  Richard Biener  <rguenther@suse.de>

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
gcc/fortran/trans-types.c

index b8e7197..ac4a237 100644 (file)
@@ -1,3 +1,9 @@
+2018-07-02  Richard Biener  <rguenther@suse.de>
+
+       PR lto/86321
+       * trans-types.c (gfc_get_array_type_bounds): Unshare TYPE_FIELDs
+       for the distinct type copy.
+
 2018-07-02  Paul Thomas  <pault@gcc.gnu.org>
 
        PR fortran/82969
index f50eb0a..5b39623 100644 (file)
@@ -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);