[PATCH] Fix pr70061

Richard Henderson rth@redhat.com
Sat Mar 5 20:02:00 GMT 2016


The problem is that we are emitting copy sequences to edges without caring
for deferred popping of arguments.  Thus when we began emitting code for the
first block, which in this case starts with a label, we had 32 bytes of
pending stack adjustment, which emit_label flushed.  The ICE is due to the
label not being the first insn in the BB.

There are two equivalent ways to fix this: we can either save/restore
inhibit_defer_pop around these sequences, or we can manually flush any
pending stack adjustment.

This does the latter.  Ok?


r~
-------------- next part --------------
	* tree-outofssa.c (emit_partition_copy): Flush pending stack adjust.
	(insert_value_copy_on_edge): Likewise.

	* gcc.c-torture/compile/pr70061.c: New test.


diff --git a/gcc/testsuite/gcc.c-torture/compile/pr70061.c b/gcc/testsuite/gcc.c-torture/compile/pr70061.c
new file mode 100644
index 0000000..a7ebcfc
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr70061.c
@@ -0,0 +1,10 @@
+typedef int v8si __attribute__ ((vector_size (32)));
+
+int
+foo(v8si c, v8si d)
+{
+l0:
+  if (c[2])
+    d ^= c;
+  return d[3];
+}
diff --git a/gcc/tree-outof-ssa.c b/gcc/tree-outof-ssa.c
index 25286a2..4125529 100644
--- a/gcc/tree-outof-ssa.c
+++ b/gcc/tree-outof-ssa.c
@@ -41,6 +41,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "tree-ssa-ter.h"
 #include "tree-ssa-coalesce.h"
 #include "tree-outof-ssa.h"
+#include "dojump.h"
 
 /* FIXME: A lot of code here deals with expanding to RTL.  All that code
    should be in cfgexpand.c.  */
@@ -220,6 +221,7 @@ emit_partition_copy (rtx dest, rtx src, int unsignedsrcp, tree sizeexp)
     }
   else
     emit_move_insn (dest, src);
+  do_pending_stack_adjust ();
 
   rtx_insn *seq = get_insns ();
   end_sequence ();
@@ -312,6 +314,8 @@ insert_value_copy_on_edge (edge e, int dest, tree src, source_location locus)
 
   if (x != dest_rtx)
     emit_move_insn (dest_rtx, x);
+  do_pending_stack_adjust ();
+
   seq = get_insns ();
   end_sequence ();
 


More information about the Gcc-patches mailing list