This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH, RTL] Fix PR 51106
- From: Andrey Belevantsev <abel at ispras dot ru>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Cc: Jakub Jelinek <jakub at redhat dot com>
- Date: Thu, 19 Jan 2012 18:13:58 +0400
- Subject: [PATCH, RTL] Fix PR 51106
Hello,
As discussed with Jakub in the PR, the problem is that a jump asm goto insn
is removed without purging the dead edges. Bootstrapped and tested on
x86-64. I had to use dg-prune-output to remove the error message and to
make the test pass, as we only checking for an ICE.
OK for trunk/4.6/4.5?
Andrey
gcc/
2012-01-19 Andrey Belevantsev <abel@ispras.ru>
PR target/51106
* function.c (instantiate_virtual_regs_in_insn): Use delete_insn_and_edges
when removing a wrong asm insn.
testsuite/
2012-01-19 Jakub Jelinek <jakub@redhat.com>
PR target/51106
* gcc.c-torture/compile/pr51106.c: New test.
diff --git a/gcc/function.c b/gcc/function.c
index fcb79f5..94e51f4 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -1737,7 +1737,7 @@ instantiate_virtual_regs_in_insn (rtx insn)
if (!check_asm_operands (PATTERN (insn)))
{
error_for_asm (insn, "impossible constraint in %<asm%>");
- delete_insn (insn);
+ delete_insn_and_edges (insn);
}
}
else
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr51106.c b/gcc/testsuite/gcc.c-torture/compile/pr51106.c
new file mode 100644
index 0000000..2f1c51d
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr51106.c
@@ -0,0 +1,19 @@
+/* { dg-options "-w" } */
+/* { dg-prune-output "impossible constraint" } */
+int
+foo (int x)
+{
+ asm goto ("" : : "i" (x) : : lab);
+ return 1;
+lab:
+ return 0;
+}
+
+int
+bar (int x)
+{
+ asm goto ("" : : "i" (x) : : lab);
+ __builtin_unreachable ();
+lab:
+ return 0;
+}