| 1 |
/* PR middle-end/57748 */ |
| 2 |
/* { dg-do run } */ |
| 3 |
/* wrong code in expand_expr_real_1. */ |
| 4 |
|
| 5 |
#include <stdlib.h> |
| 6 |
|
| 7 |
extern void abort (void); |
| 8 |
|
| 9 |
typedef long long V |
| 10 |
__attribute__ ((vector_size (2 * sizeof (long long)), may_alias)); |
| 11 |
|
| 12 |
typedef struct S { V b[1]; } P __attribute__((aligned (1))); |
| 13 |
|
| 14 |
struct __attribute__((packed)) T { char c; P s; }; |
| 15 |
|
| 16 |
void __attribute__((noinline, noclone)) |
| 17 |
check (P *p) |
| 18 |
{ |
| 19 |
if (p->b[1][0] != 3 || p->b[1][1] != 4) |
| 20 |
abort (); |
| 21 |
} |
| 22 |
|
| 23 |
void __attribute__((noinline, noclone)) |
| 24 |
foo (struct T *t) |
| 25 |
{ |
| 26 |
V a = { 3, 4 }; |
| 27 |
t->s.b[1] = a; |
| 28 |
} |
| 29 |
|
| 30 |
int |
| 31 |
main () |
| 32 |
{ |
| 33 |
struct T *t = (struct T *) calloc (128, 1); |
| 34 |
|
| 35 |
foo (t); |
| 36 |
check (&t->s); |
| 37 |
|
| 38 |
free (t); |
| 39 |
return 0; |
| 40 |
} |