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

--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Adjusted testcase for the testsuite, without relying on stdout output:

int r, *s, t, p, a, q, b;
short u = 3;
static int *v;
char c;
int cc;

__attribute__((noinline, noclone)) void
baz (const char *p, int q)
{
  asm volatile ("" : : "r" (p) : "memory");
  if (q != 1 + (cc++ == 0))
    __builtin_abort ();
  if (*p != cc)
    __builtin_abort ();
}

static int *
foo (int p1)
{
  int w = 2, j;
  while (q < 1)
    {
      int d = 6094 ^ p, e = ~r;
      p = e;
      if (!d)
        return &t;
      for (j = 0; j < 1;)
        {
          for (j = 0; j < 1; j++)
            for (; q < 2; q++)
              ;
        }
    }
  if (u)
    for (;;)
      {
        char x;
        int y, z = 1, t1;
        for (x = 7; x; x++)
          {
            int f = p || r;
            t1 = ~p | w;
            w = (u || f % a) % ~(t1 && f) - r;
            if (p < 6)
              {
                baz ("\1", t1);
                break;
              }
          }
        int g = 4 % w;
        if (g)
          {
            --p;
            int h = p && t1;
            z = h;
            if (p > 5 && z)
              continue;
          }
        y = g;
        if (z < p)
          {
            int i = g / u;
            y = i;
          }
        int j = u & y, k, o = z * x;
        if (p)
          {
            k = z;
            o = t1;
            c = x;
            z = -y;
            t1 = (j && y << c) + k || x;
            x = ~(u % p);
            if (x < c)
              baz ("\2", t1);
          }
        int l = p < z;
        short m = ((l && y) & ~u) * t1;
        int n = u && t1;
        if (t1 && x && (!x || z))
          m = l * (y && n) | x;
        baz ("\3", t1);
        if (o && m > w)
          *v = 0;
        else
          {
            if (!p1)
              continue;
            return &b;
          }
      }
}

static void
bar (char p1)
{
  s = foo (254);
  while (p1 <= 0)
    {
      s = foo (254);
      for (;;)
        ;
    }
}

int
main ()
{
  bar (4);
  if (cc != 3)
    __builtin_abort ();
  return 0;
}

Reply via email to