aboutsummaryrefslogtreecommitdiff
path: root/gcc/reg-stack.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2007-03-07 10:13:29 -0800
committerRichard Henderson <rth@gcc.gnu.org>2007-03-07 10:13:29 -0800
commit7476f0866c606870ed338f64269b840da3bcb1e4 (patch)
tree9966163c9b3bfdf8faa218f12e89e2b2c8b20dd4 /gcc/reg-stack.c
parent1611915067138d5ab84a3225599281b68943172f (diff)
downloadgcc-7476f0866c606870ed338f64269b840da3bcb1e4.zip
gcc-7476f0866c606870ed338f64269b840da3bcb1e4.tar.gz
gcc-7476f0866c606870ed338f64269b840da3bcb1e4.tar.bz2
re PR target/30848 (ICE with invalid constraint in asm statement)
PR target/30848 * reg-stack.c (emit_swap_insn): If a malformed asm was seen, silently fix up the stack in the case of a missing register. From-SVN: r122669
Diffstat (limited to 'gcc/reg-stack.c')
-rw-r--r--gcc/reg-stack.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/gcc/reg-stack.c b/gcc/reg-stack.c
index e6802b1..8413ca3 100644
--- a/gcc/reg-stack.c
+++ b/gcc/reg-stack.c
@@ -815,9 +815,19 @@ emit_swap_insn (rtx insn, stack regstack, rtx reg)
hard_regno = get_hard_regnum (regstack, reg);
- gcc_assert (hard_regno >= FIRST_STACK_REG);
if (hard_regno == FIRST_STACK_REG)
return;
+ if (hard_regno == -1)
+ {
+ /* Something failed if the register wasn't on the stack. If we had
+ malformed asms, we zapped the instruction itself, but that didn't
+ produce the same pattern of register sets as before. To prevent
+ further failure, adjust REGSTACK to include REG at TOP. */
+ gcc_assert (any_malformed_asm);
+ regstack->reg[++regstack->top] = REGNO (reg);
+ return;
+ }
+ gcc_assert (hard_regno >= FIRST_STACK_REG);
other_reg = regstack->top - (hard_regno - FIRST_STACK_REG);