gcc/testsuite/gcc.dg/gnu23-tag-alias-8.c
raw| 1 | /* { dg-do run } */ |
| 2 | /* { dg-options "-std=gnu23 -O2" } */ |
| 3 | |
| 4 | typedef struct E { int a[2]; int b; } *A; |
| 5 | |
| 6 | void* foo(void* a, void *b, void *c, void *d) |
| 7 | { |
| 8 | *(A**)a = c; |
| 9 | |
| 10 | int N = 2; |
| 11 | typedef struct E { int a[N]; int b; } *B; |
| 12 | *(B**)b = d; |
| 13 | |
| 14 | return *(A**)a; |
| 15 | } |
| 16 | |
| 17 | int main() |
| 18 | { |
| 19 | A *a, b, c; |
| 20 | if (&c != (A*)foo(&a, &a, &b, &c)) |
| 21 | __builtin_abort(); |
| 22 | } |
| 23 | |
| 24 |