view gcc/testsuite/gcc.c-torture/execute/pr87290.c @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 84e7813d76e9
children
line wrap: on
line source

/* PR middle-end/87290 */

int c;

__attribute__((noipa)) void
f0 (void)
{
  c++;
}

__attribute__((noipa)) int
f1 (int x)
{
  return x % 16 == 13;
}

__attribute__((noipa)) int
f2 (int x)
{
  return x % 16 == -13;
}

__attribute__((noipa)) void
f3 (int x)
{
  if (x % 16 == 13)
    f0 ();
}

__attribute__((noipa)) void
f4 (int x)
{
  if (x % 16 == -13)
    f0 ();
}

int
main ()
{
  int i, j;
  for (i = -30; i < 30; i++)
    {
      if (f1 (13 + i * 16) != (i >= 0) || f2 (-13 + i * 16) != (i <= 0))
	__builtin_abort ();
      f3 (13 + i * 16);
      if (c != (i >= 0))
	__builtin_abort ();
      f4 (-13 + i * 16);
      if (c != 1 + (i == 0))
	__builtin_abort ();
      for (j = 1; j < 16; j++)
	{
	  if (f1 (13 + i * 16 + j) || f2 (-13 + i * 16 + j))
	    __builtin_abort ();
	  f3 (13 + i * 16 + j);
	  f4 (-13 + i * 16 + j);
	}
      if (c != 1 + (i == 0))
	__builtin_abort ();
      c = 0;
    }
  return 0;
}