aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.dg/misaligned-expand-2.c
blob: 7f6c6d19a2563db46495a0d132bea7097d630361 (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
39
40
/* Test that expand can generate correct stores to misaligned data even on
   strict alignment platforms.  */

/* { dg-do run } */
/* { dg-options "-O0" } */

extern void abort ();

typedef unsigned int myint __attribute__((aligned(1)));

void
foo (myint *p, unsigned int i)
{
  *p = i;
}

#define cst (int) 0xdeadbeef
#define NUM 8

struct blah
{
  char c;
  myint i[NUM];
};

struct blah g;

int
main (int argc, char **argv)
{
  int k;

  for (k = 0; k < NUM; k++)
    {
      foo (&g.i[k], cst);
      if (g.i[k] != cst)
	abort ();
    }
  return 0;
}