------- Comment #7 from jakub at gcc dot gnu dot org 2010-03-21 14:16 ------- I think there are two problems in reorder_blocks{,_1}: 1) BLOCK_FRAGMENT_CHAIN should be reversed on each block when reorder_blocks_1 finishes, otherwise the chain starts with the earliest fragment (BLOCK_FRAGMENT_ORIGIN of all others), then continues with the latest fragment, then one before that etc. 2) reorder_blocks_1 sets current_block to origin, rather than block. E.g. dwarf2 doesn't care here, perhaps some debug infos that don't support fragments. The difference is that with current_block = origin; all subblocks are chained to the first fragment, rather than the fragment they actually appear in. We can certainly leave it as is if other debug info formats don't care, the only problem it causes is that then block_nreverse is called often many times on the same block, making the order pretty much unpredictable. I'd say we should block_nreverse and also reverse fragment chain order after reorder_blocks_1 finished.
-- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43442