| 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 |
T |
| 14 |
f1 (struct S x) |
| 15 |
{ |
| 16 |
struct S s = x; |
| 17 |
return *(T *) ((char *) &s.d + 1); |
| 18 |
} |
| 19 |
|
| 20 |
int |
| 21 |
f2 (struct S x) |
| 22 |
{ |
| 23 |
struct S s = x; |
| 24 |
return ((U *)((char *) &s.d + 1))[0]; |
| 25 |
} |
| 26 |
|
| 27 |
int |
| 28 |
f3 (struct S x) |
| 29 |
{ |
| 30 |
struct S s = x; |
| 31 |
return ((U *)((char *) &s.d + 1))[1]; |
| 32 |
} |
| 33 |
|
| 34 |
int |
| 35 |
f4 (struct S x) |
| 36 |
{ |
| 37 |
struct S s = x; |
| 38 |
return ((U *)((char *) &s.d + 1))[2]; |
| 39 |
} |
| 40 |
|
| 41 |
int |
| 42 |
f5 (struct S x) |
| 43 |
{ |
| 44 |
struct S s = x; |
| 45 |
return ((U *)((char *) &s.d + 1))[3]; |
| 46 |
} |