optimization/6025: linux m68k-elf-gcc cross compiler segfault
Anders Blomdell
anders.blomdell@control.lth.se
Fri Mar 22 10:10:00 GMT 2002
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6025
OK this is probably what's wrong (the correct fix eludes me though):
find_if_case_1
finds that it has a conversion to do and calls
make_edge (NULL, test_bb, then_succ->dest, 0);
flow_delete_block (then_bb);
tidy_fallthru_edge (else_edge, test_bb, else_bb);
but tidy_fallthru_edge finds the following expression true
if (next_real_insn (b->end) != next_real_insn (PREV_INSN (c->head)))
and thereby fails to set
e->flags |= EDGE_FALLTHRU;
i.e. we wind up with a newly created edge with no fall_through. The
question is if we
1. should always set EDGE_FALLTHRU in tidy_fallthru_edge()
2. should do it separately after each call to tidy_fallthru_edge()
3. backtrack the edge creation if to tidy_fallthru_edge failed
4. do something else
###################################################################
here is segfault.c.24.rnreg which I think is a dump of the program
before the call to if_convert(1).
;; Function SegFaultWhenCompiling
Basic block 0:
Basic block 1:
Closing chain %d0 at insn 102 (terminate_dead)
Register %d0 (1): 138 [DATA_REGS] 102 [GENERAL_REGS]
Register %d0 in insn 102; no available registers
Basic block 2:
Basic block 3:
(note 2 0 122 NOTE_INSN_DELETED -1347440721)
;; Start of basic block 0, registers live: 14 [%a6] 15 [%sp]
(note 122 2 4 [bb 0] NOTE_INSN_BASIC_BLOCK -1347440721)
(insn 4 122 5 (set (reg/v:SI 1 %d1 [29])
(mem/f:SI (plus:SI (reg/f:SI 14 %a6)
(const_int 8 [0x8])) 1)) 29 {*m68k.md:976} (nil)
(expr_list:REG_DEAD (reg/f:SI 14 %a6)
(expr_list:REG_EQUIV (mem/f:SI (plus:SI (reg/f:SI 14 %a6)
(const_int 8 [0x8])) 1)
(nil))))
;; End of basic block 0, registers live:
1 [%d1] 15 [%sp]
(note 5 4 10 NOTE_INSN_FUNCTION_BEG -1347440721)
(note 10 5 11 NOTE_INSN_LOOP_BEG -1347440721)
;; Start of basic block 1, registers live: 1 [%d1] 15 [%sp]
(code_label 11 10 123 3 "" "" [7 uses])
(note 123 11 138 [bb 1] NOTE_INSN_BASIC_BLOCK -1347440721)
(insn 138 123 102 (set (reg:SI 0 %d0)
(const_int 4 [0x4])) 29 {*m68k.md:976} (nil)
(nil))
(insn:QI 102 138 103 (set (cc0)
(compare (reg/v:SI 1 %d1 [29])
(reg:SI 0 %d0))) 11 {*m68k.md:518} (insn_list 138 (nil))
(expr_list:REG_DEAD (reg:SI 0 %d0)
(nil)))
(jump_insn 103 102 124 (set (pc)
(if_then_else (gtu (cc0)
(const_int 0 [0x0]))
(label_ref 87)
(pc))) 319 {bgtu} (nil)
(expr_list:REG_BR_PROB (const_int 9001 [0x2329])
(nil)))
;; End of basic block 1, registers live:
1 [%d1] 15 [%sp]
;; Start of basic block 2, registers live: 1 [%d1] 15 [%sp]
(note 124 103 107 [bb 2] NOTE_INSN_BASIC_BLOCK -1347440721)
(jump_insn 107 124 108 (set (pc)
(label_ref 11)) 336 {jump} (insn_list 106 (nil))
(nil))
;; End of basic block 2, registers live:
1 [%d1] 15 [%sp]
;; Insn is not within a basic block
(code_label 108 107 109 19 "" "" [0 uses])
;; Insn is not within a basic block
(jump_insn 109 108 110 (addr_diff_vec:HI (label_ref:SI 108)
[
(label_ref:SI 11)
(label_ref:SI 11)
(label_ref:SI 11)
(label_ref:SI 11)
(label_ref:SI 11)
]
(const_int 0 [0x0])
(const_int 0 [0x0])) -1 (nil)
(nil))
(barrier 110 109 18)
(note 18 110 23
("/home/andersb/bugs/m68k-elf-gcc-segfault/segfault.c") 15
-1347440721)
(note 23 18 25 0x4019c100 NOTE_INSN_BLOCK_BEG -1347440721)
(note/i 25 23 27 NOTE_INSN_DELETED 0)
(note 27 25 28 0x4019c100 NOTE_INSN_BLOCK_END -1347440721)
(note 28 27 32
("/home/andersb/bugs/m68k-elf-gcc-segfault/segfault.c") 16
-1347440721)
(note 32 28 37
("/home/andersb/bugs/m68k-elf-gcc-segfault/segfault.c") 18
-1347440721)
(note 37 32 39 0x4019c380 NOTE_INSN_BLOCK_BEG -1347440721)
(note/i 39 37 41 NOTE_INSN_DELETED 0)
(note 41 39 42 0x4019c380 NOTE_INSN_BLOCK_END -1347440721)
(note 42 41 46
("/home/andersb/bugs/m68k-elf-gcc-segfault/segfault.c") 19
-1347440721)
(note 46 42 51
("/home/andersb/bugs/m68k-elf-gcc-segfault/segfault.c") 21
-1347440721)
(note 51 46 53 0x4019c4e0 NOTE_INSN_BLOCK_BEG -1347440721)
(note/i 53 51 55 NOTE_INSN_DELETED 0)
(note 55 53 56 0x4019c4e0 NOTE_INSN_BLOCK_END -1347440721)
(note 56 55 60
("/home/andersb/bugs/m68k-elf-gcc-segfault/segfault.c") 22
-1347440721)
(note 60 56 65
("/home/andersb/bugs/m68k-elf-gcc-segfault/segfault.c") 24
-1347440721)
(note 65 60 67 0x4019c6e0 NOTE_INSN_BLOCK_BEG -1347440721)
(note/i 67 65 69 NOTE_INSN_DELETED 0)
(note 69 67 70 0x4019c6e0 NOTE_INSN_BLOCK_END -1347440721)
(note 70 69 74
("/home/andersb/bugs/m68k-elf-gcc-segfault/segfault.c") 25
-1347440721)
(note 74 70 79
("/home/andersb/bugs/m68k-elf-gcc-segfault/segfault.c") 27
-1347440721)
(note 79 74 81 0x40197ea0 NOTE_INSN_BLOCK_BEG -1347440721)
(note/i 81 79 83 NOTE_INSN_DELETED 0)
(note 83 81 84 0x40197ea0 NOTE_INSN_BLOCK_END -1347440721)
(note 84 83 87
("/home/andersb/bugs/m68k-elf-gcc-segfault/segfault.c") 28
-1347440721)
;; Start of basic block 3, registers live: 1 [%d1] 15 [%sp]
(code_label 87 84 125 17 "" "" [1 uses])
(note 125 87 88 [bb 3] NOTE_INSN_BASIC_BLOCK -1347440721)
(note 88 125 93
("/home/andersb/bugs/m68k-elf-gcc-segfault/segfault.c") 30
-1347440721)
(note 93 88 95 0x401ab0c0 NOTE_INSN_BLOCK_BEG -1347440721)
(insn/i 95 93 97 (set (mem:SI (const_int 4194304 [0x400000]) 1)
(mem:SI (const_int 1 [0x1]) 1)) 29 {*m68k.md:976} (nil)
(nil))
(note 97 95 98 0x401ab0c0 NOTE_INSN_BLOCK_END -1347440721)
(note 98 97 99
("/home/andersb/bugs/m68k-elf-gcc-segfault/segfault.c") 31
-1347440721)
(jump_insn 99 98 100 (set (pc)
(label_ref 11)) 336 {jump} (nil)
(nil))
;; End of basic block 3, registers live:
1 [%d1] 15 [%sp]
(barrier 100 99 113)
(note 113 100 117 NOTE_INSN_LOOP_CONT -1347440721)
(note 117 113 135 NOTE_INSN_LOOP_END -1347440721)
(note 135 117 0 NOTE_INSN_DELETED -1347440721)
;; Function f
Basic block 0:
(note 2 0 3 NOTE_INSN_DELETED -1347440721)
(note 3 2 10 NOTE_INSN_FUNCTION_BEG -1347440721)
(note 10 3 12 0x401ab580 NOTE_INSN_BLOCK_BEG -1347440721)
(note/i 12 10 13 NOTE_INSN_LOOP_BEG -1347440721)
;; Start of basic block 0, registers live: 15 [%sp]
(code_label/i 13 12 101 21 "" "" [1 uses])
(note 101 13 26 [bb 0] NOTE_INSN_BASIC_BLOCK -1347440721)
(note/i 26 101 27 0x401ab5a0 NOTE_INSN_BLOCK_BEG -1347440721)
(note/i 27 26 29 NOTE_INSN_DELETED 0)
(note/i 29 27 31 0x401ab5a0 NOTE_INSN_BLOCK_END -1347440721)
(jump_insn/i 31 29 32 (set (pc)
(label_ref 13)) 336 {jump} (nil)
(nil))
;; End of basic block 0, registers live:
15 [%sp]
(barrier/i 32 31 37)
(note/i 37 32 40 0x401ab5c0 NOTE_INSN_BLOCK_BEG -1347440721)
(note/i 40 37 48 0x401ab5c0 NOTE_INSN_BLOCK_END -1347440721)
(note/i 48 40 51 0x401ab5e0 NOTE_INSN_BLOCK_BEG -1347440721)
(note/i 51 48 59 0x401ab5e0 NOTE_INSN_BLOCK_END -1347440721)
(note/i 59 51 62 0x401ab600 NOTE_INSN_BLOCK_BEG -1347440721)
(note/i 62 59 70 0x401ab600 NOTE_INSN_BLOCK_END -1347440721)
(note/i 70 62 73 0x401ab620 NOTE_INSN_BLOCK_BEG -1347440721)
(note/i 73 70 81 0x401ab620 NOTE_INSN_BLOCK_END -1347440721)
(note/i 81 73 84 0x401ab640 NOTE_INSN_BLOCK_BEG -1347440721)
(note/i 84 81 89 0x401ab640 NOTE_INSN_BLOCK_END -1347440721)
(note/i 89 84 93 NOTE_INSN_LOOP_CONT -1347440721)
(note/i 93 89 96 NOTE_INSN_LOOP_END -1347440721)
(note 96 93 110 0x401ab580 NOTE_INSN_BLOCK_END -1347440721)
(note 110 96 0 NOTE_INSN_DELETED -1347440721)
--
------------------------------------------------------------------------------
Anders Blomdell
Department of Automatic Control Email: anders.blomdell@control.lth.se
Lund Institute of Technology Phone: +46 46 222 4625
Box 118, S-221 00 Lund, Sweden Fax: +46 46 138118
More information about the Gcc-bugs
mailing list