Patchwork resent2 [PATCH] Fix ICE in redirect_jump, at jump.c:1497 PR50496

login
register
mail settings
Submitter Chung-Lin Tang
Date Nov. 23, 2011, 1:26 p.m.
Message ID <4ECCF469.5060703@codesourcery.com>
Download mbox | patch
Permalink /patch/127305/
State New
Headers show

Comments

Chung-Lin Tang - Nov. 23, 2011, 1:26 p.m.
On 2011/11/2 11:47 PM, Bernd Schmidt wrote:
> On 10/31/11 10:11, Eric Botcazou wrote:
>>> I'm suggesting a new patch, as attached. Before reload_completed, we
>>> directly return 0 upon nlabel == NULL, which should be identical with
>>> old behavior, while asserting fail if after reload (where we assume the
>>> simple_return/return distinction is required).
>>>
>>> This should ensure better that, if a post-prologue case of redirecting
>>> to the exit block ever happens we will more easily know (by some future
>>> PR :P)
>>>
>>> Bootstrapped and tested on i686, and cross tested on ARM using QEMU.
>>> Eric, is this approach okay?
>>
>> Don't you want epilogue_completed instead of reload_completed?  Otherwise,
>> yes, the approach is fine with me, but wait for Bernd's input.
> 
> That looks good to me too.
> 
> 
> Bernd

(returning to this...)

I've re-tested using epilogue_completed to be sure, everything's clean
as expected. Just applied, attaching committed patch.

Thanks,
Chung-Lin

Patch

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 181662)
+++ ChangeLog	(working copy)
@@ -1,3 +1,9 @@ 
+2011-11-23  Chung-Lin Tang  <cltang@codesourcery.com>
+
+	PR rtl-optimization/50496
+	* jump.c (redirect_jump): Assert fail on nlabel == NULL_RTX
+	only after epilogue is created. Add comments.
+
 2011-11-22  Richard Henderson  <rth@redhat.com>
 
 	* config/ia64/ia64.c (ia64_expand_atomic_op): Add model parameter.
Index: jump.c
===================================================================
--- jump.c	(revision 181662)
+++ jump.c	(working copy)
@@ -1495,8 +1495,19 @@ 
 {
   rtx olabel = JUMP_LABEL (jump);
 
-  gcc_assert (nlabel != NULL_RTX);
+  if (!nlabel)
+    {
+      /* If there is no label, we are asked to redirect to the EXIT block.
+	 When before the epilogue is emitted, return/simple_return cannot be
+	 created so we return 0 immediately.  After the epilogue is emitted,
+	 we always expect a label, either a non-null label, or a
+	 return/simple_return RTX.  */
 
+      if (!epilogue_completed)
+	return 0;
+      gcc_unreachable ();
+    }
+
   if (nlabel == olabel)
     return 1;