gcc/
[official-gcc.git] / gcc / testsuite / gcc.dg / pr48335-2.c
bloba37c0797c3bfb4f4368374d703e631789a298152
1 /* PR middle-end/48335 */
2 /* { dg-do compile } */
3 /* { dg-options "-O2 -fno-tree-sra" } */
5 typedef long long T __attribute__((may_alias, aligned (1)));
6 typedef short U __attribute__((may_alias, aligned (1)));
8 struct S
10 _Complex float d __attribute__((aligned (8)));
13 void bar (struct S);
15 void
16 f1 (T x)
18 struct S s;
19 *(T *) ((char *) &s.d + 1) = x;
20 __real__ s.d *= 7.0;
21 bar (s);
24 void
25 f2 (int x)
27 struct S s = { .d = 0.0f };
28 ((U *)((char *) &s.d + 1))[0] = x;
29 __real__ s.d *= 7.0;
30 bar (s);
33 void
34 f3 (int x)
36 struct S s = { .d = 0.0f };
37 ((U *)((char *) &s.d + 1))[1] = x;
38 __real__ s.d *= 7.0;
39 bar (s);
42 void
43 f4 (int x)
45 struct S s = { .d = 0.0f };
46 ((U *)((char *) &s.d + 1))[2] = x;
47 __real__ s.d *= 7.0;
48 bar (s);
51 void
52 f5 (int x)
54 struct S s = { .d = 0.0f };
55 ((U *)((char *) &s.d + 1))[3] = x;
56 __real__ s.d *= 7.0;
57 bar (s);