PR tree-optimization/81303
[official-gcc.git] / gcc / testsuite / gcc.dg / misaligned-expand-3.c
blob5b1c7e7e07112352f800ca484b25b5e76bb7f1f9
1 /* Test that expand can generate correct stores to misaligned data of complex
2 type even on strict alignment platforms. */
4 /* { dg-do run } */
5 /* { dg-options "-O0" } */
7 extern void abort ();
9 typedef _Complex float mycmplx __attribute__((aligned(1)));
11 void
12 foo (mycmplx *p, float r, float i)
14 __real__ *p = r;
15 __imag__ *p = i;
18 #define cvr 3.2f
19 #define cvi 2.5f
20 #define NUM 8
22 struct blah
24 char c;
25 mycmplx x[NUM];
26 } __attribute__((packed));
28 struct blah g;
30 int
31 main (int argc, char **argv)
33 int k;
35 for (k = 0; k < NUM; k++)
37 foo (&g.x[k], cvr, cvi);
38 if (__real__ g.x[k] != cvr
39 || __imag__ g.x[k] != cvi)
40 abort ();
42 return 0;