aboutsummaryrefslogtreecommitdiff
path: root/gcc/go/go-gcc.cc
diff options
context:
space:
mode:
authorNikhil Benesch <nikhil.benesch@gmail.com>2019-02-06 04:48:35 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2019-02-06 04:48:35 +0000
commitce4321c918aa0d17ecd7da6c3deb43524b1729cf (patch)
tree33a6eb37062d4aecdffb413b9a1a362331168574 /gcc/go/go-gcc.cc
parentfbe83e6b4d0308f547ab11de6dc0eda2741cc11f (diff)
downloadgcc-ce4321c918aa0d17ecd7da6c3deb43524b1729cf.zip
gcc-ce4321c918aa0d17ecd7da6c3deb43524b1729cf.tar.gz
gcc-ce4321c918aa0d17ecd7da6c3deb43524b1729cf.tar.bz2
re PR go/89019 (LTO and gccgo cause ICE during free_lang_data)
gcc/go: PR go/89019 * go-gcc.cc (Gcc_backend::placeholder_struct_type): Mark placeholder structs as requiring structural equality. (Gcc_backend::set_placeholder_pointer_type): Propagate the canonical type from the desired pointer type to the placeholder pointer type. gcc/testsuite/: * lib/go-torture.exp: Test compiling with -flto. From-SVN: r268572
Diffstat (limited to 'gcc/go/go-gcc.cc')
-rw-r--r--gcc/go/go-gcc.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/go/go-gcc.cc b/gcc/go/go-gcc.cc
index 7fbdd07..4e9e0e3 100644
--- a/gcc/go/go-gcc.cc
+++ b/gcc/go/go-gcc.cc
@@ -1049,6 +1049,7 @@ Gcc_backend::set_placeholder_pointer_type(Btype* placeholder,
}
gcc_assert(TREE_CODE(tt) == POINTER_TYPE);
TREE_TYPE(pt) = TREE_TYPE(tt);
+ TYPE_CANONICAL(pt) = TYPE_CANONICAL(tt);
if (TYPE_NAME(pt) != NULL_TREE)
{
// Build the data structure gcc wants to see for a typedef.
@@ -1080,6 +1081,12 @@ Gcc_backend::placeholder_struct_type(const std::string& name,
get_identifier_from_string(name),
ret);
TYPE_NAME(ret) = decl;
+
+ // The struct type that eventually replaces this placeholder will require
+ // structural equality. The placeholder must too, so that the requirement
+ // for structural equality propagates to references that are constructed
+ // before the replacement occurs.
+ SET_TYPE_STRUCTURAL_EQUALITY(ret);
}
return this->make_type(ret);
}