| 1 |
/* PR middle-end/48335 */ |
| 2 |
/* { dg-do compile } */ |
| 3 |
/* { dg-options "-O2 -fno-tree-sra" } */ |
| 4 |
|
| 5 |
typedef long long T __attribute__((may_alias, aligned (1))); |
| 6 |
typedef short U __attribute__((may_alias, aligned (1))); |
| 7 |
|
| 8 |
struct S |
| 9 |
{ |
| 10 |
_Complex float d __attribute__((aligned (8))); |
| 11 |
}; |
| 12 |
|
| 13 |
void bar (struct S); |
| 14 |
|
| 15 |
void |
| 16 |
f1 (T x) |
| 17 |
{ |
| 18 |
struct S s; |
| 19 |
*(T *) ((char *) &s.d + 1) = x; |
| 20 |
__real__ s.d *= 7.0; |
| 21 |
bar (s); |
| 22 |
} |
| 23 |
|
| 24 |
void |
| 25 |
f2 (int x) |
| 26 |
{ |
| 27 |
struct S s = { .d = 0.0f }; |
| 28 |
((U *)((char *) &s.d + 1))[0] = x; |
| 29 |
__real__ s.d *= 7.0; |
| 30 |
bar (s); |
| 31 |
} |
| 32 |
|
| 33 |
void |
| 34 |
f3 (int x) |
| 35 |
{ |
| 36 |
struct S s = { .d = 0.0f }; |
| 37 |
((U *)((char *) &s.d + 1))[1] = x; |
| 38 |
__real__ s.d *= 7.0; |
| 39 |
bar (s); |
| 40 |
} |
| 41 |
|
| 42 |
void |
| 43 |
f4 (int x) |
| 44 |
{ |
| 45 |
struct S s = { .d = 0.0f }; |
| 46 |
((U *)((char *) &s.d + 1))[2] = x; |
| 47 |
__real__ s.d *= 7.0; |
| 48 |
bar (s); |
| 49 |
} |
| 50 |
|
| 51 |
void |
| 52 |
f5 (int x) |
| 53 |
{ |
| 54 |
struct S s = { .d = 0.0f }; |
| 55 |
((U *)((char *) &s.d + 1))[3] = x; |
| 56 |
__real__ s.d *= 7.0; |
| 57 |
bar (s); |
| 58 |
} |