re PR lto/84044 (Spurious -Wodr warning with -flto)
authorJan Hubicka <hubicka@ucw.cz>
Wed, 21 Nov 2018 02:38:43 +0000 (03:38 +0100)
committerJan Hubicka <hubicka@gcc.gnu.org>
Wed, 21 Nov 2018 02:38:43 +0000 (02:38 +0000)
PR lto/84044
* ipa-devirt.c (odr_types_equivalent_p): Use operand_equal_p to
compare ENUM values.
* g++.dg/lto/odr-4_0.C: New testcase.
* g++.dg/lto/odr-4_1.C: New testcase.

From-SVN: r266334

gcc/ChangeLog
gcc/ipa-devirt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/lto/odr-4_0.C [new file with mode: 0644]
gcc/testsuite/g++.dg/lto/odr-4_1.C [new file with mode: 0644]

index aece55980f0bf986ae6f76ffb42fa6af1fdc232d..3075648e439ec676d4aba88cb5ca3e018231a8e5 100644 (file)
@@ -1,3 +1,9 @@
+2018-11-20  Jan Hubicka  <hubicka@ucw.cz>
+
+       PR lto/84044
+       * ipa-devirt.c (odr_types_equivalent_p): Use operand_equal_p to
+       compare ENUM values.
+
 2018-11-20  Jakub Jelinek  <jakub@redhat.com>
 
        PR tree-optimization/87895
index 229eebcb65f1068215fbc273f0786bb956ce1667..b72789c72bb6a210e7ce53c4ec35f358ed59e9ea 100644 (file)
@@ -1343,7 +1343,7 @@ odr_types_equivalent_p (tree t1, tree t2, bool warn, bool *warned,
                           " is defined in another translation unit"));
              return false;
            }
-         if (TREE_VALUE (v1) != TREE_VALUE (v2))
+         if (!operand_equal_p (TREE_VALUE (v1), TREE_VALUE (v2), 0))
            {
              warn_odr (t1, t2, NULL, NULL, warn, warned,
                        G_("an enum with different values is defined"
index 9f1edcebfde51093c21b8589f8d41e19ccf8c125..d3ebbf0bcce3b901ad74fcb709d095c31901646f 100644 (file)
@@ -1,3 +1,9 @@
+2018-11-20  Jan Hubicka  <hubicka@ucw.cz>
+
+       PR lto/84044
+       * g++.dg/lto/odr-4_0.C: New testcase.
+       * g++.dg/lto/odr-4_1.C: New testcase.
+
 2018-11-20  Jakub Jelinek  <jakub@redhat.com>
 
        PR c++/88110
diff --git a/gcc/testsuite/g++.dg/lto/odr-4_0.C b/gcc/testsuite/g++.dg/lto/odr-4_0.C
new file mode 100644 (file)
index 0000000..5f0cf8d
--- /dev/null
@@ -0,0 +1,11 @@
+// { dg-lto-do link }
+// { dg-lto-options { -O2 -flto }  } 
+struct B {
+  enum class E { V0, V1 };
+  virtual ~B();
+  E e;
+};
+
+B b;
+
+int main() {}
diff --git a/gcc/testsuite/g++.dg/lto/odr-4_1.C b/gcc/testsuite/g++.dg/lto/odr-4_1.C
new file mode 100644 (file)
index 0000000..d1d3858
--- /dev/null
@@ -0,0 +1,9 @@
+struct B {
+  enum class E { V0, V1 };
+  virtual ~B();
+  E e;
+};
+
+B::~B() = default;
+
+