[Bug c/41440] SEG FAULT in CSE.C caused by bad RTL expansion

hutchinsonandy at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Thu Oct 1 01:50:00 GMT 2009

------- 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)

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

Regression tested on Rev15226 (20090927)
Native configuration  i686-pc-linux-gnu with no regression on C tests (G++
still running) 
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 <hutchinsonandy@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.



More information about the Gcc-bugs mailing list