------- Comment #8 from hutchinsonandy at gcc dot gnu dot org 2009-10-01 01:49 ------- Created an attachment (id=18681) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18681&action=view) Fix
After lengthy and productive correspondence with Michael Matz, we have arrived at a conclusion. The patch above is ok but it is preferred to fix the problem at the point of RTL expansion. A block that ends with a jump created by RTL expander on an otherwise fallthru edge, is padded with mov(r,r) NOP. Thus commit_one_edge_insertion() will no longer find and interpret this as a jump to successor causing the insertion point to be wrong. The problem breaks cc0 targets during CSE. Non cc0 targets can equally get erroneous insertion made inside RTL expander loop pattern. These may or may not break. Regression tested on Rev15226 (20090927) Native configuration i686-pc-linux-gnu with no regression on C tests (G++ still running) Also Target is avr-unknown-none Host is i686-pc-linux-gnu Producing 28 less failure on C testsuite, no regressions. 2009-09-30 Andy Hutchinson <hutchinsona...@gcc.gnu.org> PR middle-end/41440 * cfgexpand.c (expand_gimple_basic_block): Append NOP to a fallthru, single successor block, ending with jump created by RTL expander. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41440