diff mbox

Fix ICE with thunks (PR middle-end/61654)

Message ID 20140703184736.GM31640@tucnak.redhat.com
State New
Headers show

Commit Message

Jakub Jelinek July 3, 2014, 6:47 p.m. UTC
Hi!

update_ssa that expand_thunk calls, if it needs to change anything,
computes CDI_DOMINATORS, but we assert that dominators are not computed
when we release e.g. an unused thunk.

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

2014-07-03  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/61654
	* cgraphunit.c (expand_thunk): Call free_dominance_info.

	* g++.dg/opt/pr61654.C: New test.


	Jakub

Comments

Richard Biener July 4, 2014, 8:16 a.m. UTC | #1
On July 3, 2014 8:47:36 PM CEST, Jakub Jelinek <jakub@redhat.com> wrote:
>Hi!
>
>update_ssa that expand_thunk calls, if it needs to change anything,
>computes CDI_DOMINATORS, but we assert that dominators are not computed
>when we release e.g. an unused thunk.
>
>Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok
>for trunk/4.9?

OK.

Thanks,
Richard.

>2014-07-03  Jakub Jelinek  <jakub@redhat.com>
>
>	PR middle-end/61654
>	* cgraphunit.c (expand_thunk): Call free_dominance_info.
>
>	* g++.dg/opt/pr61654.C: New test.
>
>--- gcc/cgraphunit.c.jj	2014-07-01 19:38:24.000000000 +0200
>+++ gcc/cgraphunit.c	2014-07-03 15:51:44.329423346 +0200
>@@ -1693,6 +1693,7 @@ expand_thunk (struct cgraph_node *node,
> #ifdef ENABLE_CHECKING
>       verify_flow_info ();
> #endif
>+      free_dominance_info (CDI_DOMINATORS);
> 
>     /* Since we want to emit the thunk, we explicitly mark its name as
> 	 referenced.  */
>--- gcc/testsuite/g++.dg/opt/pr61654.C.jj	2014-07-03 15:55:42.413163208
>+0200
>+++ gcc/testsuite/g++.dg/opt/pr61654.C	2014-07-03 15:55:16.000000000
>+0200
>@@ -0,0 +1,27 @@
>+// PR middle-end/61654
>+// { dg-do compile }
>+
>+class A
>+{
>+  virtual int a (int, int = 0) = 0;
>+  int b (const int &);
>+  int c;
>+};
>+
>+class B : virtual A
>+{
>+  int d;
>+  int a (int, int);
>+};
>+
>+int
>+A::b (const int &)
>+{
>+  return a ('\0');
>+}
>+
>+int
>+B::a (int, int)
>+{
>+  return 0 ? 0 : d;
>+}
>
>	Jakub
diff mbox

Patch

--- gcc/cgraphunit.c.jj	2014-07-01 19:38:24.000000000 +0200
+++ gcc/cgraphunit.c	2014-07-03 15:51:44.329423346 +0200
@@ -1693,6 +1693,7 @@  expand_thunk (struct cgraph_node *node,
 #ifdef ENABLE_CHECKING
       verify_flow_info ();
 #endif
+      free_dominance_info (CDI_DOMINATORS);
 
       /* Since we want to emit the thunk, we explicitly mark its name as
 	 referenced.  */
--- gcc/testsuite/g++.dg/opt/pr61654.C.jj	2014-07-03 15:55:42.413163208 +0200
+++ gcc/testsuite/g++.dg/opt/pr61654.C	2014-07-03 15:55:16.000000000 +0200
@@ -0,0 +1,27 @@ 
+// PR middle-end/61654
+// { dg-do compile }
+
+class A
+{
+  virtual int a (int, int = 0) = 0;
+  int b (const int &);
+  int c;
+};
+
+class B : virtual A
+{
+  int d;
+  int a (int, int);
+};
+
+int
+A::b (const int &)
+{
+  return a ('\0');
+}
+
+int
+B::a (int, int)
+{
+  return 0 ? 0 : d;
+}