public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix ICF ICE (PR tree-optimization/65747)
@ 2015-04-12 19:08 Jakub Jelinek
  2015-04-12 20:08 ` Richard Biener
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2015-04-12 19:08 UTC (permalink / raw)
  To: Jan Hubicka, Richard Biener; +Cc: gcc-patches

Hi!

On the following testcase, ICF assumes OBJ_TYPE_REF_OBJECT must be a
SSA_NAME, but that is not the case in the testcase, where it is
ADDR_EXPR of MEM_REF instead.

Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
trunk?

2015-04-12  Jakub Jelinek  <jakub@redhat.com>

	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.

--- gcc/ipa-icf-gimple.c.jj	2015-03-14 09:49:39.000000000 +0100
+++ gcc/ipa-icf-gimple.c	2015-04-12 17:12:37.093411034 +0200
@@ -521,8 +521,8 @@ func_checker::compare_operand (tree t1,
 	    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");
 	  }
 
--- gcc/testsuite/g++.dg/torture/pr65747.C.jj	2015-04-12 17:09:15.302632192 +0200
+++ gcc/testsuite/g++.dg/torture/pr65747.C	2015-04-12 17:11:39.003338317 +0200
@@ -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());
+}

	Jakub

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Fix ICF ICE (PR tree-optimization/65747)
  2015-04-12 19:08 [PATCH] Fix ICF ICE (PR tree-optimization/65747) Jakub Jelinek
@ 2015-04-12 20:08 ` Richard Biener
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2015-04-12 20:08 UTC (permalink / raw)
  To: Jakub Jelinek, Jan Hubicka; +Cc: gcc-patches

On April 12, 2015 9:08:34 PM GMT+02:00, Jakub Jelinek <jakub@redhat.com> wrote:
>Hi!
>
>On the following testcase, ICF assumes OBJ_TYPE_REF_OBJECT must be a
>SSA_NAME, but that is not the case in the testcase, where it is
>ADDR_EXPR of MEM_REF instead.
>
>Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok
>for
>trunk?

OK.

Thanks,
Richard.

>2015-04-12  Jakub Jelinek  <jakub@redhat.com>
>
>	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.
>
>--- gcc/ipa-icf-gimple.c.jj	2015-03-14 09:49:39.000000000 +0100
>+++ gcc/ipa-icf-gimple.c	2015-04-12 17:12:37.093411034 +0200
>@@ -521,8 +521,8 @@ func_checker::compare_operand (tree t1,
> 	    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");
> 	  }
> 
>--- gcc/testsuite/g++.dg/torture/pr65747.C.jj	2015-04-12
>17:09:15.302632192 +0200
>+++ gcc/testsuite/g++.dg/torture/pr65747.C	2015-04-12
>17:11:39.003338317 +0200
>@@ -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());
>+}
>
>	Jakub


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-04-12 20:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-12 19:08 [PATCH] Fix ICF ICE (PR tree-optimization/65747) Jakub Jelinek
2015-04-12 20:08 ` Richard Biener

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).