[Bug tree-optimization/56661] [4.8/4.9 regression] Incorrect code with -O1 -ftree-pre

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Mar 20 10:19:00 GMT 2013


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56661

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-03-20 10:19:12 UTC ---
Single file simplified testcase:

__attribute__((noinline, noclone)) void
bar (int *b)
{
  b[0] = b[1] = b[2] = 1;
}

__attribute__((noinline, noclone)) int
baz (int x)
{
  if (x != 1)
    __builtin_abort ();
}

void
foo (int x)
{
  if (x == 0)
    {
      int *b = __builtin_malloc (3 * sizeof (int));
      while (b[0])
        ;
    }
  else if (x == 1)
    {
      int i, j;
      int *b = __builtin_malloc (3 * sizeof (int));
      for (i = 0; i < 2; i++)
        {
          bar (b);
          for (j = 0; j < 3; ++j)
            baz (b[j]);
          baz (b[0]);
        }
    }
}

int
main ()
{
  int x = 1;
  asm volatile ("" : "+r" (x));
  foo (x);
  return 0;
}



More information about the Gcc-bugs mailing list