aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Hubicka <hubicka@ucw.cz>2015-03-02 19:43:56 +0100
committerAldy Hernandez <aldyh@gcc.gnu.org>2015-03-02 18:43:56 +0000
commitaf5513e96b5539e4b3368050ba9064bb41b391f2 (patch)
tree7856a547196c8fe41b28857deededf53470e3272
parent7727f8f2c0e1a68851b646ad124d46a4dfb3be5d (diff)
downloadgcc-af5513e96b5539e4b3368050ba9064bb41b391f2.zip
gcc-af5513e96b5539e4b3368050ba9064bb41b391f2.tar.gz
gcc-af5513e96b5539e4b3368050ba9064bb41b391f2.tar.bz2
re PR lto/65276 (LTO: ICE add_type_duplicate, at ipa-devirt.c:1462)
PR lto/65276 * ipa-devirt.c (add_type_duplicate): Remove odr_violated assert when checking TYPE_BINFO. Co-Authored-By: Aldy Hernandez <aldyh@redhat.com> From-SVN: r221121
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/ipa-devirt.c1
-rw-r--r--gcc/testsuite/g++.dg/lto/pr65276_0.C61
-rw-r--r--gcc/testsuite/g++.dg/lto/pr65276_1.C34
4 files changed, 102 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 862f839..da14db8 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2015-03-02 Jan Hubicka <hubicka@ucw.cz>
+ Aldy Hernandez <aldyh@redhat.com>
+
+ PR lto/65276
+ * ipa-devirt.c (add_type_duplicate): Remove odr_violated assert
+ when checking TYPE_BINFO.
+
2015-03-02 Richard Biener <rguenther@suse.de>
PR ipa/65270
diff --git a/gcc/ipa-devirt.c b/gcc/ipa-devirt.c
index c3f8b15..fe29932 100644
--- a/gcc/ipa-devirt.c
+++ b/gcc/ipa-devirt.c
@@ -1459,7 +1459,6 @@ add_type_duplicate (odr_type val, tree type)
&& polymorphic_type_binfo_p (TYPE_BINFO (type1))
!= polymorphic_type_binfo_p (TYPE_BINFO (type2))))
{
- gcc_assert (val->odr_violated);
base_mismatch = true;
break;
}
diff --git a/gcc/testsuite/g++.dg/lto/pr65276_0.C b/gcc/testsuite/g++.dg/lto/pr65276_0.C
new file mode 100644
index 0000000..c8e9699
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/pr65276_0.C
@@ -0,0 +1,61 @@
+// { dg-lto-do link }
+// { dg-lto-options {{-flto -O0 -std=c++11}} }
+
+/* pr65276_0.C should get compiled with -O0, while the _1.C file
+ should get compiled with -O2, and the entire thing should be linked
+ with -O0. Test that we don't get an ICE. */
+
+extern "C++"
+{
+ namespace std
+ {
+ class exception
+ {
+ public:
+ virtual ~ exception () noexcept;
+ };
+ }
+}
+namespace std
+{
+ struct __cow_string
+ {
+ union
+ {
+ const char *_M_p;
+ char _M_bytes[sizeof (const char *)];
+ };
+ };
+ class runtime_error:public exception
+ {
+ __cow_string _M_msg;
+ };
+}
+namespace std
+{
+ class system_error:public std::runtime_error
+ {
+ };
+ enum _Ios_Fmtflags
+ {
+ };
+ inline constexpr _Ios_Fmtflags operator& (_Ios_Fmtflags __a,
+ _Ios_Fmtflags __b)
+ {
+ return _Ios_Fmtflags ();
+ }
+ enum _Ios_Openmode
+ {
+ };
+ class ios_base
+ {
+ public:
+ class __attribute ((__abi_tag__ ("cxx11"))) failure:public system_error
+ {
+ };
+ class Init
+ {
+ };
+ };
+ static ios_base::Init __ioinit;
+}
diff --git a/gcc/testsuite/g++.dg/lto/pr65276_1.C b/gcc/testsuite/g++.dg/lto/pr65276_1.C
new file mode 100644
index 0000000..ee49752
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/pr65276_1.C
@@ -0,0 +1,34 @@
+// { dg-options "-O2" }
+#pragma implementation
+#pragma interface
+extern "C++"
+{
+ namespace std
+ {
+ class exception
+ {
+ public:
+ virtual ~ exception () noexcept;
+ };
+ }
+}
+namespace std
+{
+ struct __cow_string
+ {
+ union
+ {
+ const char *_M_p;
+ char _M_bytes[sizeof (const char *)];
+ };
+ };
+ class runtime_error:public exception
+ {
+ __cow_string _M_msg;
+ };
+}
+
+int main()
+{
+ return 0;
+}