view gcc/testsuite/gcc.dg/tree-ssa/pr91091-1.c @ 152:2b5abeee2509

update gcc11
author anatofuz
date Mon, 25 May 2020 07:50:57 +0900
parents 1830386684a0
children
line wrap: on
line source

/* { dg-do run } */
/* { dg-options "-O3 -fno-strict-aliasing" } */

struct s { __INT32_TYPE__ x; } __attribute__((packed));
struct t { __INT32_TYPE__ x; };

void __attribute__((noinline,noipa))
swap(struct s* p, struct t* q)
{
  p->x = q->x;
  q->x = p->x;
}

int main()
{    
  struct t a[2];
  a[0].x = 0x12345678;
  a[1].x = 0x98765432;
  swap ((struct s *)((char *)a + 1), a);
  if (a[0].x != 0x12345678)
    __builtin_abort ();
  return 0;
}