public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/101186] New: predictable comparison of integer variables not folded
@ 2021-06-24  4:25 dizhao at os dot amperecomputing.com
  2021-06-24  4:33 ` [Bug tree-optimization/101186] " pinskia at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: dizhao at os dot amperecomputing.com @ 2021-06-24  4:25 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101186

            Bug ID: 101186
           Summary: predictable comparison of integer variables not folded
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dizhao at os dot amperecomputing.com
  Target Milestone: ---

GCC fail to remove dead codes for following cases:

#include <stdio.h>

void f (unsigned int a, unsigned int b, unsigned int c)
// if a,b,c are signed, VRP can remove dead code
{
  if (a == b)
    {
      printf ("a");
      if (c < a)
        {
          printf ("b");
          if (c >= b)
            printf ("Unreachable!");
        }
    }
}

void g (int a, int b, int x, int y)
{
  int c = y;
  if (a != 0)
    c = x;
  while (b < 1000)
  // without this loop, jump thread & VRP can remove dead code
    {
      if (a != 0)
        {
          if (c > x)
            printf ("Unreachable!");
        }
      else
        printf ("a\n");
      b++;
    }
}

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

end of thread, other threads:[~2021-07-19  6:35 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-24  4:25 [Bug tree-optimization/101186] New: predictable comparison of integer variables not folded dizhao at os dot amperecomputing.com
2021-06-24  4:33 ` [Bug tree-optimization/101186] " pinskia at gcc dot gnu.org
2021-06-24  6:49 ` rguenth at gcc dot gnu.org
2021-06-24  6:50 ` rguenth at gcc dot gnu.org
2021-06-24  9:08 ` dizhao at os dot amperecomputing.com
2021-06-24 18:30 ` amacleod at redhat dot com
2021-06-27 15:30 ` aldyh at gcc dot gnu.org
2021-06-27 15:33 ` aldyh at gcc dot gnu.org
2021-06-28 19:20 ` law at gcc dot gnu.org
2021-07-19  6:35 ` pinskia at gcc dot gnu.org

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