This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug debug/51471] [4.7 Regression] gcc.c-torture/execute/20040811-1.c and gcc.c-torture/execute/vla-dealloc-1.c fails at -O3 -g on mips64-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51471

vries at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |vries at gcc dot gnu.org

--- Comment #5 from vries at gcc dot gnu.org 2011-12-12 12:45:53 UTC ---
I can reproduce this:

20040811-1.c.220r.vartrack:
...
(jump_insn:TI 82 77 93 3 (set (pc)
        (if_then_else (ne (reg/v:SI 3 $3 [orig:210 nD.1374 ] [210])
                (reg:SI 7 $7 [255]))
            (label_ref:SI 30)
            (pc))) 20040811-1.c:16 434 {*branch_equalitysi}
     (expr_list:REG_EQUAL (if_then_else (ne (reg/v:SI 3 $3 [orig:210 nD.1374 ]
[210])
                (const_int 1000000 [0xf4240]))
            (label_ref:SI 30)
            (pc))
        (expr_list:REG_BR_PROB (const_int 9899 [0x26ab])
            (nil)))
 -> 30)

(note 93 82 133 4 [bb 4] NOTE_INSN_BASIC_BLOCK)

(note 133 93 122 4 NOTE_INSN_EPILOGUE_BEG)

(insn 122 133 123 4 (clobber (mem/c:BLK (reg/f:SI 29 $sp) [4 A8]))
20040811-1.c:19 -1
     (nil))

(insn/f:TI 123 122 148 4 (set (reg/f:SI 29 $sp)
        (reg/f:SI 30 $fp)) 20040811-1.c:19 280 {*movsi_internal}
     (expr_list:REG_CFA_DEF_CFA (plus:SI (reg/f:SI 29 $sp)
            (const_int 32 [0x20]))
        (nil)))
...

20040811-1.c.221r.mach:
...
(insn 153 77 93 (sequence [
            (jump_insn:TI 82 77 123 (set (pc)
                    (if_then_else (ne (reg/v:SI 3 $3 [orig:210 nD.1374 ] [210])
                            (reg:SI 7 $7 [255]))
                        (label_ref:SI 30)
            (pc))) 20040811-1.c:16 434 {*branch_equalitysi}
                 (expr_list:REG_BR_PRED (const_int 14 [0xe])
                    (expr_list:REG_EQUAL (if_then_else (ne (reg/v:SI 3 $3
[orig:210 nD.1374 ] [210])
                (const_int 1000000 [0xf4240]))
                            (label_ref:SI 30)
                            (pc))
                        (expr_list:REG_BR_PROB (const_int 9899 [0x26ab])
                            (nil))))
             -> 30)
            (insn/f:TI 123 82 93 (set (reg/f:SI 29 $sp)
                    (reg/f:SI 30 $fp)) 280 {*movsi_internal}
                 (expr_list:REG_CFA_DEF_CFA (plus:SI (reg/f:SI 29 $sp)
                        (const_int 32 [0x20]))
                    (nil)))
        ]) 20040811-1.c:16 -1
     (nil))

(note 93 153 133 [bb 4] NOTE_INSN_BASIC_BLOCK)

(note 133 93 122 NOTE_INSN_EPILOGUE_BEG)

(insn 122 133 148 (clobber (mem/c:BLK (reg/f:SI 29 $sp) [4 A8]))
20040811-1.c:19 -1
     (nil))
...


This looks similar to PR51271.  In both cases, an insn from the epilogue is
moved to before the epilogue by delay slot scheduling during
pass_machine_reorg, which causes an inconsistent cfa state.

Indeed the clobber 122 reads $29 and the moved insn 123 sets $29, so if delay
slot scheduling would handle clobbers, that should have stopped it. But
resource.c:mark_referenced_resources seems to ignore standalone clobbers:
...
    case CLOBBER:
      return;
...

Furthermore, in PR51271 both insn 141 and insn 143 are moved before the
epilogue, but the insn causing the assert AFAIU is insn 141, which is both
before the clobber, and not interfering with the clobber:
...
(note 155 81 141 9 NOTE_INSN_EPILOGUE_BEG)

(insn 141 155 142 9 (set (reg:DI 28 $28)
        (mem/c:DI (plus:SI (reg/f:SI 29 $sp)
                (const_int 8 [0x8])) [4 S8 A64])) res_hconf.c:11 278
{*movdi_64bit}
     (nil))

(insn 142 141 143 9 (clobber (mem/c:BLK (reg/f:SI 29 $sp) [4 A8]))
res_hconf.c:11 -1
     (nil))

(insn/f 143 142 89 9 (set (reg/f:SI 29 $sp)
        (plus:SI (reg/f:SI 29 $sp)
            (const_int 16 [0x10]))) res_hconf.c:11 10 {*addsi3}
     (expr_list:REG_CFA_DEF_CFA (reg/f:SI 29 $sp)
        (expr_list:REG_CFA_RESTORE (reg:DI 28 $28)
            (nil))))
...

So my question is: what is the mechanism that should prevent epilogue insns
from being moved to before the epilogue?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]