[Bug tree-optimization/126942] [17 Regression] Wrong code at -O1/s on x86_64-pc-linux-gnu since r17-3298

"jakub at gcc dot gnu.org via Gcc-bugs" <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126942

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |amacleod at redhat dot com,
                   |                            |jakub at gcc dot gnu.org
           Priority|P3                          |P1
           Keywords|needs-bisection             |
            Summary|[17 Regression] Wrong code  |[17 Regression] Wrong code
                   |at -O1/s on                 |at -O1/s on
                   |x86_64-pc-linux-gnu         |x86_64-pc-linux-gnu since
                   |                            |r17-3298

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Started with r17-3298-g836cb4ed48c987a4a9027cb14e6b6e1edeebcaf3
Slightly cleaned up:
signed char a;
int b, c;
short d[1];

short
foo (short *f, short g)
{
  int i = 0, j, l;
  long n = 1;
  for (int m = 0; m < a; m++)
    for (; i <= m; i++)
      n = i;
  for (unsigned k = 0; k < g; k++)
    {
      l = 0;
      do
        if (f)
          j = l + a;
      while (++l <= k);
    }
  n ^= j;
  while (a)
    n ^= b;
  return n;
}

int
main ()
{
  if (foo (d, 2) != 0)
    __builtin_abort ();
}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.