[Bug rtl-optimization/18861] [4.0 Regression] ICE Segmentation fault in try_crossjump_to_edge at ../../gcc/gcc/cfgcleanup.c:1637 with two switches (table jumps)

jakub at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Wed Jan 5 12:21:00 GMT 2005


------- Additional Comments From jakub at gcc dot gnu dot org  2005-01-05 12:20 -------
Yeah, looks like a latent bug.
I'd say the problem is incorrect cfg after conversion from gimple to rtl,
particularly that basic blocks that end with a tablejump have extra edges
to bb's with abort (), but the tablejump can't jump to it:
Basic block 1 prev 0, next 2, loop_depth 0, count 0, freq 5000, maybe hot.
Predecessors:  0 [50.0%]  (fallthru)
Successors:  3 [50.0%]  2 [50.0%]  (fallthru)

Basic block 2 prev 1, next 3, loop_depth 0, count 0, freq 2500, maybe hot.
Predecessors:  1 [50.0%]  (fallthru)
Successors:  7 [14.3%]  8 [14.3%]  9 [14.3%]  10 [14.3%]  11 [14.3%]  12 [14.3%] 
3 [14.3%]

(jump_insn 19 18 94 1 (set (pc)
        (if_then_else (gtu (reg:CC 17 flags)
                (const_int 0 [0x0]))
            (label_ref 27)
            (pc))) 337 {*jcc_1} (nil)
    (expr_list:REG_BR_PROB (const_int 5000 [0x1388])
        (nil)))
;; End of basic block 1, registers live:
 (nil)

;; Start of basic block 2, registers live: (nil)
(note 94 19 21 2 [bb 2] NOTE_INSN_BASIC_BLOCK)

(insn 21 94 22 2 (set (reg:SI 63)
        (mem/u/c:SI (plus:SI (mult:SI (reg:SI 61)
                    (const_int 4 [0x4]))
                (label_ref:SI 24)) [0 S4 A8])) 35 {*movsi_1} (nil)
    (insn_list:REG_LABEL 24 (nil)))

(jump_insn 22 21 23 2 (parallel [
            (set (pc)
                (reg:SI 63))
            (use (label_ref 24))
        ]) 353 {*tablejump_1} (nil)
    (nil))
;; End of basic block 2, registers live:
 (nil)

(barrier 23 22 24)

;; Insn is not within a basic block
(code_label 24 23 25 11 "" [2 uses])

;; Insn is not within a basic block
(jump_insn 25 24 26 (addr_vec:SI [
            (label_ref:SI 50)
            (label_ref:SI 55)
            (label_ref:SI 60)
            (label_ref:SI 65)
            (label_ref:SI 70)
            (label_ref:SI 75)
        ]) -1 (nil)
    (nil))

(barrier 26 25 27)

;; Start of basic block 3, registers live: (nil)
(code_label 27 26 28 3 4 "" [1 uses])

(note 28 27 30 3 [bb 3] NOTE_INSN_BASIC_BLOCK)

(call_insn 30 28 31 3 (call (mem:QI (symbol_ref:SI ("abort") [flags 0x41]
<function_decl 0xf7d1fca8 abort>) [0 S1 A8])
        (const_int 0 [0x0])) -1 (nil)
    (expr_list:REG_NORETURN (const_int 0 [0x0])
        (expr_list:REG_EH_REGION (const_int 0 [0x0])
            (nil)))
    (nil))
;; End of basic block 3, registers live:
 (nil)

(barrier 31 30 32)

The bb with abort is a successor at tree level of the switch bb, but when that
bb is split into a conditional jump to the abort bb and tablejump, apparently
the edge is not removed.
-floop-optimize2 is needed for this because the old loop optimizer calls
find_basic_blocks, i.e. recreates all basic blocks from scratch and the recreated
edges are correct.
Do you agree?

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |jakub at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2004-12-06 23:07:59         |2005-01-05 12:20:33
               date|                            |


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



More information about the Gcc-bugs mailing list