------- Comment #14 from danglin at gcc dot gnu dot org 2005-12-19 04:45 ------- I did a checkout as of Sep 12, 2005 00:00:00 UTC and get the same assembly code as in the initial report using the following compilation options: "-Os -w -S -mschedule=7100LC". The build was done on hppa2.0w-hp-hpux11.11.
Here's some rtl from 54.barriers and 55.dbr showing the end of the initial loop in the function testB: (jump_insn:TI 18 15 186 (set (pc) (if_then_else (ne (reg/v/f:SI 6 %r6 [orig:98 p___4463 ] [98]) (reg/f:SI 19 %r19 [111])) (label_ref:SI 11) (pc))) 25 {*pa.md:1700} (insn_list:REG_DEP_TRUE 17 (insn_list:REG_DE P_ANTI 13 (insn_list:REG_DEP_TRUE 15 (nil)))) (expr_list:REG_DEAD (reg/f:SI 19 %r19 [111]) (expr_list:REG_BR_PROB (const_int 8750 [0x222e]) (nil)))) (note 186 18 20 NOTE_INSN_LOOP_END) (note 20 186 45 [bb 2] NOTE_INSN_BASIC_BLOCK) (note 45 20 23 NOTE_INSN_DELETED) (insn:TI 23 45 21 (set (reg:SI 28 %r28 [114]) (mem/s/j/c:SI (plus:SI (reg/v/f:SI 6 %r6 [orig:98 p___4463 ] [98]) (const_int -8 [0xfffffff8])) [0+0 S4 A32])) 37 {*pa.md:2291} (ni l) (expr_list:REG_EQUAL (mem/s/j/c:SI (plus:SI (reg/v/f:SI 6 %r6 [orig:98 p___4 463 ] [98]) (const_int -8 [0xfffffff8])) [0+0 S4 A32]) (nil))) (insn 21 23 196 (set (reg:SI 1 %r1) (high:SI (symbol_ref:SI ("sB") [flags 0x80] <var_decl 7afc1bb0 sB>))) 48 {*pa.md:2737} (nil) (expr_list:REG_EQUIV (high:SI (symbol_ref:SI ("sB") [flags 0x80] <var_decl 7 afc1bb0 sB>)) (nil))) ---- (insn 253 15 186 (sequence [ (jump_insn:TI 18 15 23 (set (pc) (if_then_else (ne (reg/v/f:SI 6 %r6 [orig:98 p___4463 ] [98] ) (reg/f:SI 19 %r19 [111])) (label_ref:SI 11) (pc))) 25 {*pa.md:1700} (insn_list:REG_DEP_TRUE 17 (insn _list:REG_DEP_ANTI 13 (insn_list:REG_DEP_TRUE 15 (nil)))) (expr_list:REG_BR_PRED (const_int 6 [0x6]) (expr_list:REG_DEAD (reg/f:SI 19 %r19 [111]) (expr_list:REG_BR_PROB (const_int 8750 [0x222e]) (nil))))) (insn:TI 23 18 186 (set (reg:SI 28 %r28 [114]) (mem/s/j/c:SI (plus:SI (reg/v/f:SI 6 %r6 [orig:98 p___4463 ] [98]) (const_int -8 [0xfffffff8])) [0+0 S4 A32])) 37 {*pa. md:2291} (nil) (expr_list:REG_EQUAL (mem/s/j/c:SI (plus:SI (reg/v/f:SI 6 %r6 [o rig:98 p___4463 ] [98]) (const_int -8 [0xfffffff8])) [0+0 S4 A32]) (nil))) ]) -1 (nil) (nil)) (note 186 253 20 NOTE_INSN_LOOP_END) (note 20 186 45 [bb 2] NOTE_INSN_BASIC_BLOCK) (note 45 20 21 NOTE_INSN_DELETED) (insn 21 45 196 (set (reg:SI 1 %r1) (high:SI (symbol_ref:SI ("sB") [flags 0x80] <var_decl 7afc1bb0 sB>))) 48 {*pa.md:2737} (nil) (expr_list:REG_EQUIV (high:SI (symbol_ref:SI ("sB") [flags 0x80] <var_decl 7 afc1bb0 sB>)) (nil))) As can be seen, the memory load that causes the segmentation fault was outside the loop in the 54.barriers pass. >From an optimisation standpoint, I'm a bit surprised that the memory load was selected for placement into the delay slot rather than the following set. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23954