From 48d1f31d1b7131e8f809ede8256e4f1eb6c5c3ae Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Wed, 21 Nov 2018 03:38:43 +0100 Subject: [PATCH] re PR lto/84044 (Spurious -Wodr warning with -flto) 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 | 6 ++++++ gcc/ipa-devirt.c | 2 +- gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/g++.dg/lto/odr-4_0.C | 11 +++++++++++ gcc/testsuite/g++.dg/lto/odr-4_1.C | 9 +++++++++ 5 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/lto/odr-4_0.C create mode 100644 gcc/testsuite/g++.dg/lto/odr-4_1.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index aece55980f0..3075648e439 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-11-20 Jan Hubicka + + PR lto/84044 + * ipa-devirt.c (odr_types_equivalent_p): Use operand_equal_p to + compare ENUM values. + 2018-11-20 Jakub Jelinek PR tree-optimization/87895 diff --git a/gcc/ipa-devirt.c b/gcc/ipa-devirt.c index 229eebcb65f..b72789c72bb 100644 --- a/gcc/ipa-devirt.c +++ b/gcc/ipa-devirt.c @@ -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" diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9f1edcebfde..d3ebbf0bcce 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2018-11-20 Jan Hubicka + + 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 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 index 00000000000..5f0cf8d0fc2 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/odr-4_0.C @@ -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 index 00000000000..d1d3858f109 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/odr-4_1.C @@ -0,0 +1,9 @@ +struct B { + enum class E { V0, V1 }; + virtual ~B(); + E e; +}; + +B::~B() = default; + + -- 2.30.2