diff options
author | Uros Bizjak <uros@gcc.gnu.org> | 2008-11-05 10:57:49 +0100 |
---|---|---|
committer | Uros Bizjak <uros@gcc.gnu.org> | 2008-11-05 10:57:49 +0100 |
commit | 34e4536eaf1433a0b364f7f038e5fb2759ce745a (patch) | |
tree | b697a42591d93cdc1589d01203f88cfe8d6c216a /gcc/reg-stack.c | |
parent | 8e66def0a1bc07d210f40e5df3e12745c8453043 (diff) | |
download | gcc-34e4536eaf1433a0b364f7f038e5fb2759ce745a.tar.gz |
re PR middle-end/37286 (gfortran, trunk: ICE subst_stack_regs_pat, at reg-stack.c:1537)
PR middle-end/37286
* reg-stack.c (subst_stack_regs_pat) [MINUS, DIV, MULT, PLUS]:
Initialize uninitialized input registers with a NaN.
testsuite/ChangeLog:
PR middle-end/37286
* gfortran.dg/pr37286.f90: New test.
From-SVN: r141603
Diffstat (limited to 'gcc/reg-stack.c')
-rw-r--r-- | gcc/reg-stack.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/gcc/reg-stack.c b/gcc/reg-stack.c index eb31bc835cf..0cde0cbc26e 100644 --- a/gcc/reg-stack.c +++ b/gcc/reg-stack.c @@ -1527,15 +1527,30 @@ subst_stack_regs_pat (rtx insn, stack regstack, rtx pat) else { /* Both operands are REG. If neither operand is already - at the top of stack, choose to make the one that is the dest - the new top of stack. */ + at the top of stack, choose to make the one that is the + dest the new top of stack. */ int src1_hard_regnum, src2_hard_regnum; src1_hard_regnum = get_hard_regnum (regstack, *src1); src2_hard_regnum = get_hard_regnum (regstack, *src2); - gcc_assert (src1_hard_regnum != -1); - gcc_assert (src2_hard_regnum != -1); + + /* If the source is not live, this is yet another case of + uninitialized variables. Load up a NaN instead. */ + if (src1_hard_regnum == -1) + { + rtx pat2 = gen_rtx_CLOBBER (VOIDmode, *src1); + rtx insn2 = emit_insn_before (pat2, insn); + control_flow_insn_deleted + |= move_nan_for_stack_reg (insn2, regstack, *src1); + } + if (src2_hard_regnum == -1) + { + rtx pat2 = gen_rtx_CLOBBER (VOIDmode, *src2); + rtx insn2 = emit_insn_before (pat2, insn); + control_flow_insn_deleted + |= move_nan_for_stack_reg (insn2, regstack, *src2); + } if (src1_hard_regnum != FIRST_STACK_REG && src2_hard_regnum != FIRST_STACK_REG) |