[tree-ssa]: After edge insertion, two bb's share the same heda

Daniel Berlin dberlin@dberlin.org
Sat Jul 26 01:12:00 GMT 2003


After insertion into a switch statement, I end up with two bb's that 
share the same head pointer

(gdb) p bb->index
$7 = 345
(gdb) p bb->head_tree_p
$8 = (tree *) 0x42afe2dc
(gdb) p basic_block_info.data.bb[444].head_tree_p
$9 = (tree *) 0x42afe2dc

Is this allowed?
It screws up normal insertion royally.

Note that 345 was an empty block (but still had the same head_tree_p) 
at the time 444 was created by bsi_insert_on_edge_immediate.

The edge we insert on is also from 54->346 (346 is the successor block 
of 345), so it looks like collateral damage that we chose the same 
head_tree_p as block 345.

We end up with head_tree_p of block 345, and using it, after line 3820 
of tree-cfg.c:

3820      tsi = tsi_last (&BIND_EXPR_BODY (SWITCH_BODY (sw_stmt)));

IE after this line, tsi points to block 345's head_tree_p, and we build 
a statement and append it into the new bb, and the new bb gets 345's 
head_tree_p:

We then append this to the new bb here:
3827      append_stmt_to_bb (tsi_container (tsi), new_bb, sw_stmt);


Andrew, the switch statement insertion is beyond my comprehension.  If 
I send you the test case and instructions, can you look at this?


Diego, as an FYI, this is now the problem in 176.gcc after fixing the 
problem in SSAPRE's code causing the segfault.


--Dan



More information about the Gcc mailing list