From: Jan Hubicka Date: Fri, 26 Oct 2018 09:32:47 +0000 (+0200) Subject: ipa-devirt.c (odr_subtypes_equivalent_p): Fix recursion. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=abb967da1c0d6deb98de488213aaaa06a785adc5;p=gcc.git ipa-devirt.c (odr_subtypes_equivalent_p): Fix recursion. * ipa-devirt.c (odr_subtypes_equivalent_p): Fix recursion. (warn_types_mismatch): Fix walk of DECL_NAME. (odr_types_equivalent_p): Fix overactive assert. * lto/lto-symtab.c (lto_symtab_merge_decls_2): Fix extra space. * g++.dg/lto/odr-1_0.C: Fix template. * g++.dg/lto/odr-1_1.C: Fix template. From-SVN: r265523 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d46a3b47a55..57876065a66 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-10-26 Jan Hubicka + + * ipa-devirt.c (odr_subtypes_equivalent_p): Fix recursion. + (warn_types_mismatch): Fix walk of DECL_NAME. + (odr_types_equivalent_p): Fix overactive assert. + 2018-10-26 Richard Biener PR tree-optimization/87105 diff --git a/gcc/ipa-devirt.c b/gcc/ipa-devirt.c index df880fe4145..d92e6f42f3e 100644 --- a/gcc/ipa-devirt.c +++ b/gcc/ipa-devirt.c @@ -719,9 +719,10 @@ odr_subtypes_equivalent_p (tree t1, tree t2, bool warn, bool *warned, } if (visited->add (pair)) return true; - if (odr_types_equivalent_p (TYPE_MAIN_VARIANT (t1), TYPE_MAIN_VARIANT (t2), - false, NULL, visited, loc1, loc2) - && !type_variants_equivalent_p (t1, t2, warn, warned)) + if (!odr_types_equivalent_p (TYPE_MAIN_VARIANT (t1), TYPE_MAIN_VARIANT (t2), + false, NULL, visited, loc1, loc2)) + return false; + if (!type_variants_equivalent_p (t1, t2, warn, warned)) return false; return true; } @@ -1138,7 +1139,7 @@ warn_types_mismatch (tree t1, tree t2, location_t loc1, location_t loc2) if (TREE_CODE (n1) == TYPE_DECL) n1 = DECL_NAME (n1); if (TREE_CODE (n2) == TYPE_DECL) - n1 = DECL_NAME (n2); + n2 = DECL_NAME (n2); /* Most of the time, the type names will match, do not be unnecesarily verbose. */ if (IDENTIFIER_POINTER (n1) != IDENTIFIER_POINTER (n2)) @@ -1292,10 +1293,6 @@ odr_types_equivalent_p (tree t1, tree t2, bool warn, bool *warned, /* Check first for the obvious case of pointer identity. */ if (t1 == t2) return true; - gcc_assert (!type_with_linkage_p (TYPE_MAIN_VARIANT (t1)) - || !type_in_anonymous_namespace_p (TYPE_MAIN_VARIANT (t1))); - gcc_assert (!type_with_linkage_p (TYPE_MAIN_VARIANT (t2)) - || !type_in_anonymous_namespace_p (TYPE_MAIN_VARIANT (t2))); /* Can't be the same type if the types don't have the same code. */ if (TREE_CODE (t1) != TREE_CODE (t2)) diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog index c0e9f1c3d71..a5d1ff2a024 100644 --- a/gcc/lto/ChangeLog +++ b/gcc/lto/ChangeLog @@ -1,3 +1,7 @@ +2018-10-26 Jan Hubicka + + * lto/lto-symtab.c (lto_symtab_merge_decls_2): Fix extra space. + 2018-10-17 David Malcolm * Make-lang.in (selftest-lto): New. diff --git a/gcc/lto/lto-symtab.c b/gcc/lto/lto-symtab.c index cf08d455d87..4b24b84774d 100644 --- a/gcc/lto/lto-symtab.c +++ b/gcc/lto/lto-symtab.c @@ -698,7 +698,7 @@ lto_symtab_merge_decls_2 (symtab_node *first, bool diagnosed_p) if (level & 2) diag = warning_at (DECL_SOURCE_LOCATION (decl), OPT_Wodr, - "%qD violates the C++ One Definition Rule ", + "%qD violates the C++ One Definition Rule", decl); if (!diag && (level & 1)) diag = warning_at (DECL_SOURCE_LOCATION (decl), diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 36627afeaa3..5dab9a853ec 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-10-26 Jan Hubicka + + * g++.dg/lto/odr-1_0.C: Fix template. + * g++.dg/lto/odr-1_1.C: Fix template. + 2018-10-26 Richard Biener PR tree-optimization/87105 diff --git a/gcc/testsuite/g++.dg/lto/odr-1_0.C b/gcc/testsuite/g++.dg/lto/odr-1_0.C index 8eabe7b1583..7967e1d895e 100644 --- a/gcc/testsuite/g++.dg/lto/odr-1_0.C +++ b/gcc/testsuite/g++.dg/lto/odr-1_0.C @@ -3,6 +3,6 @@ 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'" } }; -void test(struct a *) // { dg-lto-warning "6: warning: 'test' violates the C\\+\\+ One Definition Rule" } +void test(struct a *) { } diff --git a/gcc/testsuite/g++.dg/lto/odr-1_1.C b/gcc/testsuite/g++.dg/lto/odr-1_1.C index 5cd6f6c0ebc..ef2f55a69aa 100644 --- a/gcc/testsuite/g++.dg/lto/odr-1_1.C +++ b/gcc/testsuite/g++.dg/lto/odr-1_1.C @@ -4,7 +4,7 @@ namespace { struct a { struct b *ptr; }; -void test(struct a *); +void test(struct a *); // { dg-lto-warning "6: 'test' violates the C\\+\\+ One Definition Rule" } int main(void) {