On Tue, Sep 09, 2025 at 12:12:11AM +0200, Martin Uecker wrote: > I meant a string that is valid (and also human readable) > C representation of the type, not a mangled version.
Oh! Yes, that would be very nice too. :) > If I am not mistaken, it would currently not agree between C and C. > > typedef int arr_t[]; > typedef int arr3_t[3]; > > void f(arr3_t); > > void g(void (*fp)(arr_t)) { > > int a[3]; > (*fp)(&a); // this call would fail? > } > > int h() > { > g(&f); > } Both decay to int *; the mangling ABI sees "void(int*)" as _ZTSFvPiE. I test for this in a few ways in the last patch with adds the dg tests: +extern void func_int_array(int arr[]); /* _ZTSFvPiE -> 0xb2a15cf9 (same as int*) */ +extern void func_int_ptr(int *x); /* _ZTSFvPiE -> 0xb2a15cf9 */ ... +extern void func_vla_1d(int n, int arr[n]); /* _ZTSFviPiE -> 0x0d1f87aa */ +extern void func_vla_empty(int n, int arr[]); /* _ZTSFviPiE -> 0x0d1f87aa */ +extern void func_vla_ptr(int n, int *arr); /* _ZTSFviPiE -> 0x0d1f87aa */ ... +extern void func_vla_2d_first(int n, int arr[n][10]); /* _ZTSFviPA10_iE -> 0x2cd9653d */ +extern void func_vla_2d_empty(int n, int arr[][10]); /* _ZTSFviPA10_iE -> 0x2cd9653d */ +extern void func_vla_2d_ptr(int n, int (*arr)[10]); /* _ZTSFviPA10_iE -> 0x2cd9653d */ I can add a non-VLA numeric case, if you want, but I think it's redundant to the others. -Kees -- Kees Cook