From b6e55e484b2ab28f8367e19146da825f084441f6 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Sun, 12 Apr 2015 21:30:51 +0200 Subject: [PATCH] re PR middle-end/65747 (ICE (in compare_ssa_name, at ipa-icf-gimple.c:134) on x86_64-linux-gnu) PR tree-optimization/65747 * ipa-icf-gimple.c (func_checker::compare_operand): Use compare_operand rather than compare_ssa_name for OBJ_TYPE_REF_OBJECT. * g++.dg/torture/pr65747.C: New test. From-SVN: r222024 --- gcc/ChangeLog | 6 ++++ gcc/ipa-icf-gimple.c | 4 +-- gcc/testsuite/ChangeLog | 5 +++ gcc/testsuite/g++.dg/torture/pr65747.C | 48 ++++++++++++++++++++++++++ 4 files changed, 61 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.dg/torture/pr65747.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 97a1500b4f3..1443d20e574 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2015-04-12 Jakub Jelinek + + PR tree-optimization/65747 + * ipa-icf-gimple.c (func_checker::compare_operand): Use compare_operand + rather than compare_ssa_name for OBJ_TYPE_REF_OBJECT. + 2015-04-12 Gerald Pfeifer * doc/invoke.texi (-Wmemset-transposed-args): Break a long diff --git a/gcc/ipa-icf-gimple.c b/gcc/ipa-icf-gimple.c index 568407da2fd..09adce3d3ec 100644 --- a/gcc/ipa-icf-gimple.c +++ b/gcc/ipa-icf-gimple.c @@ -521,8 +521,8 @@ func_checker::compare_operand (tree t1, tree t2) if (!types_same_for_odr (obj_type_ref_class (t1), obj_type_ref_class (t2))) return return_false_with_msg ("OBJ_TYPE_REF OTR type mismatch"); - if (!compare_ssa_name (OBJ_TYPE_REF_OBJECT (t1), - OBJ_TYPE_REF_OBJECT (t2))) + if (!compare_operand (OBJ_TYPE_REF_OBJECT (t1), + OBJ_TYPE_REF_OBJECT (t2))) return return_false_with_msg ("OBJ_TYPE_REF object mismatch"); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ea6b3a487fe..062512f017e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-04-12 Jakub Jelinek + + PR tree-optimization/65747 + * g++.dg/torture/pr65747.C: New test. + 2015-04-12 Jakub Jelinek PR c++/65736 diff --git a/gcc/testsuite/g++.dg/torture/pr65747.C b/gcc/testsuite/g++.dg/torture/pr65747.C new file mode 100644 index 00000000000..a556db5afff --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr65747.C @@ -0,0 +1,48 @@ +// PR tree-optimization/65747 +// { dg-do compile } + +struct A {}; +struct E { + virtual A m2(); +} *a; +struct B { + char b[sizeof (E)]; + void m1(); +}; +struct C { + B c; + void m3() { c.m1(); } + friend class D; +}; +struct D { + int m4(C); + void m5(); + void m6(int, C); + void m7(int, C); + void m8(); + bool m9(); + void m10(int); + void m11(int); +}; +void B::m1() { a = (E *)b; a->m2(); } +void D::m10(int) { m8(); } +void D::m11(int) { m8(); } +int D::m4(C p1) { p1.m3(); return 0; } +void D::m6(int, C p2) { + int b = 0; + if (m9()) { + m4(p2); + m10(b); + } else + m5(); + m10(int()); +} +void D::m7(int, C p2) { + int c = 0; + if (m9()) { + m4(p2); + m11(c); + } else + m5(); + m11(int()); +} -- 2.30.2