From ce4321c918aa0d17ecd7da6c3deb43524b1729cf Mon Sep 17 00:00:00 2001 From: Nikhil Benesch Date: Wed, 6 Feb 2019 04:48:35 +0000 Subject: [PATCH] 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 --- gcc/go/ChangeLog | 9 +++++++++ gcc/go/go-gcc.cc | 7 +++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/lib/go-torture.exp | 3 ++- 4 files changed, 23 insertions(+), 1 deletion(-) diff --git a/gcc/go/ChangeLog b/gcc/go/ChangeLog index 0a579bd..d75aea9 100644 --- a/gcc/go/ChangeLog +++ b/gcc/go/ChangeLog @@ -1,3 +1,12 @@ +2019-02-05 Nikhil Benesch + + 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 PR go/86343 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); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2c6d0e4..0dd171c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-02-05 Nikhil Benesch + + PR go/89019 + * lib/go-torture.exp: Test compiling with -flto. + 2019-02-06 Joseph Myers PR c/88584 diff --git a/gcc/testsuite/lib/go-torture.exp b/gcc/testsuite/lib/go-torture.exp index 213711e..a7eca18 100644 --- a/gcc/testsuite/lib/go-torture.exp +++ b/gcc/testsuite/lib/go-torture.exp @@ -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 }] } -- 2.7.4