diff mbox

[Committed/Obvious] Fix PR 49474: ICE on ppc-linux with -O3 in cprop.c

Message ID CA+=Sn1=YJkY-v+WXJEysE+O1ZLAuh16Uch5N8mf-qGZjQ1Ud+w@mail.gmail.com
State New
Headers show

Commit Message

Andrew Pinski July 12, 2011, 6:44 p.m. UTC
On Tue, Jul 12, 2011 at 11:42 AM, Andrew Pinski <pinskia@gmail.com> wrote:
> Hi,
>  The problem here is the code reads:
>       /* Check for more than one successor.  */
>     if (! EDGE_COUNT (bb->succs) > 1)
> But that expression is always false as ! has a higher precedence than
>> does.  So the obvious thing is to rewrite this statement as:
>  if (EDGE_COUNT (bb->succs) <= 1)
> And that fixes the problem.  The only case where this case matters is
> with __builtin_unreachable as fis_get_condition will return null for
> all other cases where there are only one successor edge and we check
> that result.
>
> Committed as obvious after a bootstrap/test on x86_64-linux-gnu.
>
> Thanks,
> Andrew Pinski
>
> ChangeLog:

* cprop.c (find_implicit_sets): Correct the condition.
diff mbox

Patch

Index: testsuite/gcc.c-torture/compile/pr49474.c
===================================================================
--- testsuite/gcc.c-torture/compile/pr49474.c	(revision 0)
+++ testsuite/gcc.c-torture/compile/pr49474.c	(revision 0)
@@ -0,0 +1,16 @@ 
+typedef struct gfc_formal_arglist
+{
+  int next;
+}
+gfc_actual_arglist;
+update_arglist_pass (gfc_actual_arglist* lst, int po, unsigned argpos,
+       const char *name)
+{
+  ((void)(__builtin_expect(!(argpos > 0), 0) ? __builtin_unreachable(), 0 : 0));
+  if (argpos == 1)
+      return 0;
+  if (lst)
+    lst->next = update_arglist_pass (lst->next, po, argpos - 1, name);
+  else
+    lst = update_arglist_pass (((void *)0), po, argpos - 1, name);
+}
Index: cprop.c
===================================================================
--- cprop.c	(revision 176187)
+++ cprop.c	(working copy)
@@ -1332,7 +1332,7 @@  find_implicit_sets (void)
   FOR_EACH_BB (bb)
     {
       /* Check for more than one successor.  */
-      if (! EDGE_COUNT (bb->succs) > 1)
+      if (EDGE_COUNT (bb->succs) <= 1)
 	continue;
 
       cond = fis_get_condition (BB_END (bb));