aboutsummaryrefslogtreecommitdiff
path: root/gcc/ipa-devirt.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2018-03-02 09:57:43 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2018-03-02 09:57:43 +0000
commit2265b6fed12036c1219fabe3ce78ffd386646aaf (patch)
tree7118250c90b986098ebb6d324bc007ba1a17536b /gcc/ipa-devirt.c
parent587b2f674c954f9e5fd8786c655d763c090a85de (diff)
downloadgcc-2265b6fed12036c1219fabe3ce78ffd386646aaf.zip
gcc-2265b6fed12036c1219fabe3ce78ffd386646aaf.tar.gz
gcc-2265b6fed12036c1219fabe3ce78ffd386646aaf.tar.bz2
re PR ipa/83983 (FAIL: g++.dg/lto/pr83121 (test for LTO warnings, pr83121_0.C line 8))
PR ipa/83983 * ipa-devirt.c (odr_subtypes_equivalent_p): Get the ODR type of both arguments if they are comparable. From-SVN: r258133
Diffstat (limited to 'gcc/ipa-devirt.c')
-rw-r--r--gcc/ipa-devirt.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/gcc/ipa-devirt.c b/gcc/ipa-devirt.c
index f66dc45..fae8207 100644
--- a/gcc/ipa-devirt.c
+++ b/gcc/ipa-devirt.c
@@ -684,9 +684,14 @@ odr_subtypes_equivalent_p (tree t1, tree t2,
{
if (!types_same_for_odr (t1, t2, true))
return false;
- /* Limit recursion: If subtypes are ODR types and we know
- that they are same, be happy. */
- if (!odr_type_p (t1) || !get_odr_type (t1, true)->odr_violated)
+ /* Limit recursion: if subtypes are ODR types and we know that they are
+ same, be happy. We need to call get_odr_type on both subtypes since
+ we don't know which among t1 and t2 defines the common ODR type and
+ therefore which call will report the ODR violation, if any. */
+ if (!odr_type_p (t1)
+ || !odr_type_p (t2)
+ || (!get_odr_type (t1, true)->odr_violated
+ && !get_odr_type (t2, true)->odr_violated))
return true;
}