aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pr84877.c
blob: 234fcd24e636dc5bf0113dd17021a67d6e3a85ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/* { dg-do run { xfail { cris-*-* sparc*-*-* } } } */
/* { dg-options "-O2" } */

#include <inttypes.h>

struct U {
    int M0;
    int M1;
} __attribute ((aligned (16)));

volatile struct U p0 = {1, 0};

void __attribute__ ((noinline))
foo (struct U p)
{

  volatile intptr_t mask = 0b1111;
  volatile int dummy[2];
  struct U p1 = p;
  dummy[1] = p.M0;

  if ((intptr_t)(&p1) & mask)
    __builtin_abort ();
  if ((intptr_t)(&p) & mask)
    __builtin_abort ();

  if (p1.M0 != dummy[1])
    __builtin_abort ();
  if (p1.M1 != p.M1)
    __builtin_abort ();
}

int
main ()
{
  foo (p0);
  return 0;
}