re PR go/89019 (LTO and gccgo cause ICE during free_lang_data)
authorNikhil Benesch <nikhil.benesch@gmail.com>
Wed, 6 Feb 2019 04:48:35 +0000 (04:48 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Wed, 6 Feb 2019 04:48:35 +0000 (04:48 +0000)
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

gcc/go/ChangeLog
gcc/go/go-gcc.cc
gcc/testsuite/ChangeLog
gcc/testsuite/lib/go-torture.exp

index 0a579bd94177fb4f4eb95ed42717af3edb804025..d75aea951f5dc8cdd95e5712099f8677238851d6 100644 (file)
@@ -1,3 +1,12 @@
+2019-02-05  Nikhil Benesch  <nikhil.benesch@gmail.com>
+
+        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.
+
 2019-01-09  Ian Lance Taylor  <iant@golang.org>
 
        PR go/86343
index 7fbdd0741191260d1c6bb61d4d2c01d41ae8b58e..4e9e0e3026a64413e80c43349561e8b4f442a87b 100644 (file)
@@ -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);
 }
index 2c6d0e47b5c7789e28b1255ad54a59dc6494b94d..0dd171c9647bd12c164c5201346cd27f2d016836 100644 (file)
@@ -1,3 +1,8 @@
+2019-02-05  Nikhil Benesch  <nikhil.benesch@gmail.com>
+
+        PR go/89019
+        * lib/go-torture.exp: Test compiling with -flto.
+
 2019-02-06  Joseph Myers  <joseph@codesourcery.com>
 
        PR c/88584
index 213711e41df1bdd999777a7d2a868b0ef9b50ff9..a7eca1844167f791788c0821a9f404740d2e95f9 100644 (file)
@@ -34,7 +34,8 @@ if ![info exists TORTURE_OPTIONS] {
        { -O2 -fomit-frame-pointer -finline-functions -funroll-loops } \
        { -O2 -fbounds-check } \
        { -O3 -g } \
-       { -Os }]
+       { -Os } \
+       { -flto }]
 }