view gcc/testsuite/gcc.c-torture/execute/pr54985.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
line wrap: on
line source


typedef struct st {
    int a;
} ST;

int __attribute__((noinline,noclone))
foo(ST *s, int c)
{
  int first = 1;
  int count = c;
  ST *item = s;
  int a = s->a;
  int x;

  while (count--)
    {
      x = item->a;
      if (first)
        first = 0;
      else if (x >= a)
        return 1;
      a = x;
      item++;
    }
  return 0;
}

extern void abort (void);

int main ()
{
  ST _1[2] = {{2}, {1}};
  if (foo(_1, 2) != 0)
    abort ();
  return 0;
}