gcc/testsuite/gcc.c-torture/execute/pr43987.c
raw| 1 | char B[256 * sizeof(void *)]; |
| 2 | typedef void *FILE; |
| 3 | typedef struct globals { |
| 4 | int c; |
| 5 | FILE *l; |
| 6 | } __attribute__((may_alias)) T; |
| 7 | void add_input_file(FILE *file) |
| 8 | { |
| 9 | (*(T*)&B).l[0] = file; |
| 10 | } |
| 11 | extern void abort (void); |
| 12 | int main() |
| 13 | { |
| 14 | FILE x; |
| 15 | (*(T*)&B).l = &x; |
| 16 | add_input_file ((void *)-1); |
| 17 | if ((*(T*)&B).l[0] != (void *)-1) |
| 18 | abort (); |
| 19 | return 0; |
| 20 | } |