public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Committed/Obvious] Fix PR 49474: ICE on ppc-linux with -O3 in cprop.c
@ 2011-07-12 18:46 Andrew Pinski
  2011-07-12 19:20 ` Andrew Pinski
  0 siblings, 1 reply; 2+ messages in thread
From: Andrew Pinski @ 2011-07-12 18:46 UTC (permalink / raw)
  To: GCC Patches

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:

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Committed/Obvious] Fix PR 49474: ICE on ppc-linux with -O3 in cprop.c
  2011-07-12 18:46 [Committed/Obvious] Fix PR 49474: ICE on ppc-linux with -O3 in cprop.c Andrew Pinski
@ 2011-07-12 19:20 ` Andrew Pinski
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Pinski @ 2011-07-12 19:20 UTC (permalink / raw)
  To: GCC Patches

[-- Attachment #1: Type: text/plain, Size: 810 bytes --]

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.

[-- Attachment #2: fixpr49474.diff.txt --]
[-- Type: text/plain, Size: 1116 bytes --]

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-07-12 18:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-12 18:46 [Committed/Obvious] Fix PR 49474: ICE on ppc-linux with -O3 in cprop.c Andrew Pinski
2011-07-12 19:20 ` Andrew Pinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).