Patchwork ifcvt/crossjump patch: Fix PR 42496, 21803

login
register
mail settings
Submitter Bernd Schmidt
Date Sept. 23, 2010, 3:50 p.m.
Message ID <4C9B7736.1010504@codesourcery.com>
Download mbox | patch
Permalink /patch/65542/
State New
Headers show

Comments

Bernd Schmidt - Sept. 23, 2010, 3:50 p.m.
On 09/23/2010 04:41 PM, Richard Guenther wrote:
>> I now get an bootstrap fail building Ada on x86_64-linux in
>>
>> Program received signal SIGSEGV, Segmentation fault.
>> 0x0000000000c9ebf6 in df_simulate_one_insn_backwards (bb=0x7ffff3f0ad68,
>>    insn=0x0, live=0x50bab30)
>>    at /space/rguenther/src/svn/trunk/gcc/df-problems.c:3640
>> 3640      if (!NONDEBUG_INSN_P (insn))

It found two matching blocks, each of which had 5 insns, but didn't stop
there since BB_END was a DEBUG_INSN.  The first insns in the two
following basic blocks matched, so flow_find_head_matching_sequence
returned 6.

The following patch should fix it; ok after bootstrap/test?


Bernd
* cfgcleanup.c (flow_find_head_matching_sequence): Terminate when
	reaching the end of a block if it occurs at a DEBUG_INSN.
Richard Guenther - Sept. 23, 2010, 9:36 p.m.
On Thu, Sep 23, 2010 at 5:50 PM, Bernd Schmidt <bernds@codesourcery.com> wrote:
> On 09/23/2010 04:41 PM, Richard Guenther wrote:
>>> I now get an bootstrap fail building Ada on x86_64-linux in
>>>
>>> Program received signal SIGSEGV, Segmentation fault.
>>> 0x0000000000c9ebf6 in df_simulate_one_insn_backwards (bb=0x7ffff3f0ad68,
>>>    insn=0x0, live=0x50bab30)
>>>    at /space/rguenther/src/svn/trunk/gcc/df-problems.c:3640
>>> 3640      if (!NONDEBUG_INSN_P (insn))
>
> It found two matching blocks, each of which had 5 insns, but didn't stop
> there since BB_END was a DEBUG_INSN.  The first insns in the two
> following basic blocks matched, so flow_find_head_matching_sequence
> returned 6.
>
> The following patch should fix it; ok after bootstrap/test?

Ok.

Thanks,
Richard.

>
> Bernd
>

Patch

Index: cfgcleanup.c
===================================================================
--- cfgcleanup.c	(revision 164552)
+++ cfgcleanup.c	(working copy)
@@ -1184,7 +1184,6 @@  flow_find_head_matching_sequence (basic_
 
   while (true)
     {
-
       /* Ignore notes.  */
       while (!NONDEBUG_INSN_P (i1) && i1 != BB_END (bb1))
 	i1 = NEXT_INSN (i1);
@@ -1192,6 +1191,10 @@  flow_find_head_matching_sequence (basic_
       while (!NONDEBUG_INSN_P (i2) && i2 != BB_END (bb2))
 	i2 = NEXT_INSN (i2);
 
+      if ((i1 == BB_END (bb1) && !NONDEBUG_INSN_P (i1))
+	  || (i2 == BB_END (bb2) && !NONDEBUG_INSN_P (i2)))
+	break;
+
       if (NOTE_P (i1) || NOTE_P (i2)
 	  || JUMP_P (i1) || JUMP_P (i2))
 	break;