view gcc/testsuite/gcc.dg/tree-ssa/pr91091-1.c @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +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;
}