This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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.

--- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]