gcc/testsuite/gcc.dg/pr107557-1.c
raw| 1 | /* PR107557 |
| 2 | * { dg-do compile } |
| 3 | * { dg-require-effective-target lto } |
| 4 | * { dg-options "-flto -fsanitize=undefined -fexceptions -Wno-incompatible-pointer-types" } |
| 5 | */ |
| 6 | |
| 7 | |
| 8 | int c[1][3*2]; |
| 9 | int f(int * const m, int (**v)[*m * 2]) |
| 10 | { |
| 11 | return &(c[0][*m]) == &((*v)[0][*m]); |
| 12 | } |
| 13 | int test(int n, int (*(*fn)(void))[n]) |
| 14 | { |
| 15 | return (*fn())[0]; |
| 16 | } |
| 17 | int main() |
| 18 | { |
| 19 | int m = 3; |
| 20 | int (*d)[3*2] = c; |
| 21 | int (*fn[m])(void); |
| 22 | return f(&m, &d) + test(m, &fn); |
| 23 | } |
| 24 | |
| 25 |