]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/gcc.dg/misaligned-expand-2.c
Update copyright years.
[thirdparty/gcc.git] / gcc / testsuite / gcc.dg / misaligned-expand-2.c
1 /* Test that expand can generate correct stores to misaligned data even on
2 strict alignment platforms. */
3
4 /* { dg-do run } */
5 /* { dg-options "-O0" } */
6
7 extern void abort ();
8
9 typedef unsigned int myint __attribute__((aligned(1)));
10
11 void
12 foo (myint *p, unsigned int i)
13 {
14 *p = i;
15 }
16
17 #define cst (int) 0xdeadbeef
18 #define NUM 8
19
20 struct blah
21 {
22 char c;
23 myint i[NUM];
24 };
25
26 struct blah g;
27
28 int
29 main (int argc, char **argv)
30 {
31 int k;
32
33 for (k = 0; k < NUM; k++)
34 {
35 foo (&g.i[k], cst);
36 if (g.i[k] != cst)
37 abort ();
38 }
39 return 0;
40 }