>       PR lto/87957
>       * tree.c (fld_decl_context): Break out from ...
>       (free_lang_data_in_decl): ... here; free TREE_PUBLIC, TREE_PRIVATE
>       DECL_ARTIFICIAL of TYPE_DECL; do not free TREE_TYPE of TYPE_DECL.
>       (fld_incomplete_type_of): Build copy of TYP_DECL.
>       * ipa-devirt.c (free_enum_values): Rename to ...
>       (free_odr_warning_data): ... this one; free also duplicated TYPE_DECLs
>       and TREE_TYPEs of TYPE_DECLs.
Hi,
and here are the testcases from the PR which I finally managed to
annotate so they are accepted :)

        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.
Index: g++.dg/lto/odr-1_0.C
===================================================================
--- g++.dg/lto/odr-1_0.C        (revision 266333)
+++ g++.dg/lto/odr-1_0.C        (working copy)
@@ -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;
 }
Index: g++.dg/lto/odr-1_1.C
===================================================================
--- g++.dg/lto/odr-1_1.C        (revision 266333)
+++ g++.dg/lto/odr-1_1.C        (working copy)
@@ -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;
 }
Index: g++.dg/lto/odr-2_0.C
===================================================================
--- g++.dg/lto/odr-2_0.C        (nonexistent)
+++ g++.dg/lto/odr-2_0.C        (working copy)
@@ -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;
+}
Index: g++.dg/lto/odr-2_1.C
===================================================================
--- g++.dg/lto/odr-2_1.C        (nonexistent)
+++ g++.dg/lto/odr-2_1.C        (working copy)
@@ -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; }
Index: g++.dg/lto/odr-3_0.C
===================================================================
--- g++.dg/lto/odr-3_0.C        (nonexistent)
+++ g++.dg/lto/odr-3_0.C        (working copy)
@@ -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; }
+
Index: g++.dg/lto/odr-3_1.C
===================================================================
--- g++.dg/lto/odr-3_1.C        (nonexistent)
+++ g++.dg/lto/odr-3_1.C        (working copy)
@@ -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; }
+

Reply via email to