rosenberg: handle bit fields better
[smatch.git] / validation / vla-sizeof-ice.c
blob472da6a4190761ed28e5842e0cc85b422421d9b5
1 // credit goes to Martin Uecker for the awesome ICE_P macro
3 #define ICE_P(x) \
4 (__builtin_types_compatible_p(typeof(0?((void*)((long)(x)*0l)):(int*)1),int*))
6 #define T(x) __builtin_choose_expr(ICE_P(x), 1, 0)
7 #define TEST(x, r) _Static_assert(T(x) == r, #x " => " #r)
9 static void test(int n)
11 char foo[n++];
13 TEST(sizeof(foo), 0);
17 * check-name: vla-sizeof-ice
18 * check-command: sparse -Wno-vla $file