+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
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);