view gcc/testsuite/g++.dg/torture/pr55875.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

// { dg-do run }

struct A
{
  short int a1;
  unsigned char a2;
  unsigned int a3;
};

struct B
{
  unsigned short b1;
  const A *b2;
};

B b;

__attribute__((noinline, noclone))
int foo (unsigned x)
{
  __asm volatile ("" : "+r" (x) : : "memory");
  return x;
}

inline void
bar (const int &)
{
}

__attribute__((noinline)) void
baz ()
{
  const A *a = b.b2;
  unsigned int i;
  unsigned short n = b.b1;
  for (i = 0; i < n; ++i)
    if (a[i].a1 == 11)
      {
    if (i > 0 && (a[i - 1].a2 & 1))
      continue;
    bar (foo (2));
    return;
      }
}

int
main ()
{
  A a[4] = { { 10, 0, 0 }, { 11, 1, 0 }, { 11, 1, 0 }, { 11, 1, 0 } };
  b.b1 = 4;
  b.b2 = a;
  baz ();
  return 0;
}