This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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



------- Comment #6 from hutchinsonandy at gcc dot gnu dot org  2009-09-27 17:30 -------
Created an attachment (id=18663)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18663&action=view)
Patch to cfgrtl.c  commit_one_edge_insertion()

The problem is in cfgrtl.c function commit_one_edge_insertion()

It does copy value for phi nodes to previous edge. If it find jump on edge it 
places copy before it. It assumes that edge is fall thru edge.
For a fall thru edge, the last instruction can be anything - specifically a
jump just created by RTL expander.

The bug has been present since Rev 146817

I have attached patch that correct the problem.


Index: cfgrtl.c
===================================================================
--- cfgrtl.c    (revision 152217)
+++ cfgrtl.c    (working copy)
@@ -1482,8 +1482,9 @@
             happens on the fr30 for example.

             We know this block has a single successor, so we can just emit
-            the queued insns before the jump.  */
-         if (JUMP_P (BB_END (bb)))
+            the queued insns before the jump. Fallthru edges can have
+            jumps created by RTL expander, so ignore these.  */
+         if (!(e->flags & EDGE_FALLTHRU) && JUMP_P (BB_END (bb)))
            before = BB_END (bb);
          else
            {


-- 


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]