From 4cd5da011d6174e7cb152913acac760fb4a84c11 Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Wed, 21 Nov 2018 18:32:19 +0100 Subject: [PATCH] =?utf8?q?re=20PR=20ipa/87957=20(ICE=20tree=20check:=20exp?= =?utf8?q?ected=20tree=20that=20contains=20=E2=80=98decl=20minimal?= =?utf8?q?=E2=80=99=20structure,=20have=20=E2=80=98identifier=5Fnode?= =?utf8?q?=E2=80=99=20in=20warn=5Fodr,=20at=20ipa-devirt.c:1051=20since=20?= =?utf8?q?r265519)?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit PR lto/87957 * g++.dg/lto/odr-1_0.C: Extend by mismatched enum. * g++.dg/lto/odr-1_1.C: Extend by mismatched enum. * g++.dg/lto/odr-2_0.C: New. * g++.dg/lto/odr-2_0.C: New. * g++.dg/lto/odr-3_1.C: New. * g++.dg/lto/odr-3_1.C: New. From-SVN: r266351 --- gcc/testsuite/ChangeLog | 10 ++++++++++ gcc/testsuite/g++.dg/lto/odr-1_0.C | 5 ++++- gcc/testsuite/g++.dg/lto/odr-1_1.C | 14 +++++++++----- gcc/testsuite/g++.dg/lto/odr-2_0.C | 8 ++++++++ gcc/testsuite/g++.dg/lto/odr-2_1.C | 4 ++++ gcc/testsuite/g++.dg/lto/odr-3_0.C | 12 ++++++++++++ gcc/testsuite/g++.dg/lto/odr-3_1.C | 9 +++++++++ 7 files changed, 56 insertions(+), 6 deletions(-) create mode 100644 gcc/testsuite/g++.dg/lto/odr-2_0.C create mode 100644 gcc/testsuite/g++.dg/lto/odr-2_1.C create mode 100644 gcc/testsuite/g++.dg/lto/odr-3_0.C create mode 100644 gcc/testsuite/g++.dg/lto/odr-3_1.C diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f12fb97745e..29b0c83fc89 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,13 @@ +2018-11-21 Jan Hubicka + + PR lto/87957 + * g++.dg/lto/odr-1_0.C: Extend by mismatched enum. + * g++.dg/lto/odr-1_1.C: Extend by mismatched enum. + * g++.dg/lto/odr-2_0.C: New. + * g++.dg/lto/odr-2_0.C: New. + * g++.dg/lto/odr-3_1.C: New. + * g++.dg/lto/odr-3_1.C: New. + 2018-11-21 Jakub Jelinek PR target/87839 diff --git a/gcc/testsuite/g++.dg/lto/odr-1_0.C b/gcc/testsuite/g++.dg/lto/odr-1_0.C index 7967e1d895e..6fff88844c3 100644 --- a/gcc/testsuite/g++.dg/lto/odr-1_0.C +++ b/gcc/testsuite/g++.dg/lto/odr-1_0.C @@ -1,8 +1,11 @@ // PR c++/82414 // { dg-lto-do link } +enum vals {aa,cc}; // { dg-lto-warning "6: type 'vals' violates the C\\+\\+ One Definition Rule" } struct a { // { dg-lto-warning "8: type 'struct a' violates the C\\+\\+ One Definition Rule" } struct b *ptr; // { dg-lto-message "13: the first difference of corresponding definitions is field 'ptr'" } + enum vals vals; }; -void test(struct a *) +void test(struct a *a) { + a->vals = cc; } diff --git a/gcc/testsuite/g++.dg/lto/odr-1_1.C b/gcc/testsuite/g++.dg/lto/odr-1_1.C index 5cd6f6c0ebc..33a13f01bf2 100644 --- a/gcc/testsuite/g++.dg/lto/odr-1_1.C +++ b/gcc/testsuite/g++.dg/lto/odr-1_1.C @@ -1,12 +1,16 @@ namespace { - struct b; + struct b; // { dg-lto-message "type 'struct b' defined in anonymous namespace can not match across the translation unit boundary" } } -struct a { - struct b *ptr; -}; +enum vals {aa,bb,cc}; // { dg-lto-message "an enum with different value name is defined in another translation unit" } +struct a { // { dg-lto-message "a different type is defined in another translation unit" } + struct b *ptr; // { dg-lto-message "a field of same name but different type is defined in another translation unit" } + enum vals vals; +} a; void test(struct a *); int main(void) { - test (0); + test (&a); + if (a.vals==aa) + return 1; } diff --git a/gcc/testsuite/g++.dg/lto/odr-2_0.C b/gcc/testsuite/g++.dg/lto/odr-2_0.C new file mode 100644 index 00000000000..222fa2c1db9 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/odr-2_0.C @@ -0,0 +1,8 @@ +// { dg-lto-do link } +// { dg-lto-options { { -O0 -flto } } +enum a {} b; // { dg-lto-warning "6: type 'a' violates the C\\+\\+ One Definition Rule" } +int +main(void) +{ + return 0; +} diff --git a/gcc/testsuite/g++.dg/lto/odr-2_1.C b/gcc/testsuite/g++.dg/lto/odr-2_1.C new file mode 100644 index 00000000000..f384ae893b7 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/odr-2_1.C @@ -0,0 +1,4 @@ +class a { // { dg-lto-message "a different type is defined in another translation unit" } + int *b() const; +}; +int *a::b() const { return 0; } diff --git a/gcc/testsuite/g++.dg/lto/odr-3_0.C b/gcc/testsuite/g++.dg/lto/odr-3_0.C new file mode 100644 index 00000000000..bfa6c0bea1e --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/odr-3_0.C @@ -0,0 +1,12 @@ +// { dg-lto-do link } +// { dg-lto-options { -O0 -flto } } + +typedef struct { + int a; // { dg-lto-message "the first difference of corresponding definitions is field 'a'" } +} YYSTYPE; // { dg-lto-warning "3: warning: type ‘struct YYSTYPE’ violates the C\\+\\+ One Definition Rule" } +union yyalloc { // { dg-lto-warning "7: type ‘union yyalloc’ violates the C\\+\\+ One Definition Rule" } + short yyss; + YYSTYPE yyvs; // { dg-lto-message "the first difference of corresponding definitions is field ‘yyvs’" } +}; +void b() { yyalloc c; } + diff --git a/gcc/testsuite/g++.dg/lto/odr-3_1.C b/gcc/testsuite/g++.dg/lto/odr-3_1.C new file mode 100644 index 00000000000..8a444862555 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/odr-3_1.C @@ -0,0 +1,9 @@ +typedef struct YYSTYPE { // { dg-lto-message ":16 a different type is defined in another translation unit" } +} YYSTYPE; +union yyalloc { + short yyss; + YYSTYPE yyvs; // { dg-lto-message "the first difference of corresponding definitions is field ‘yyvs’" } + +}; +void a() { yyalloc b; } + -- 2.30.2