diff options
author | uros <uros@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-11-05 09:57:49 +0000 |
---|---|---|
committer | uros <uros@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-11-05 09:57:49 +0000 |
commit | 1e8379be04cd0b727697089c4594f24ec1cef409 (patch) | |
tree | b697a42591d93cdc1589d01203f88cfe8d6c216a /gcc/reg-stack.c | |
parent | 46a4c7d86a4ce2c5395fbcb7356ea26bcc0e7ce0 (diff) | |
download | gcc-1e8379be04cd0b727697089c4594f24ec1cef409.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@141603 138bc75d-0d04-0410-961f-82ee72b054a4
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) |