1 // credit goes to Martin Uecker for the awesome ICE_P macro
   2 
   3 #define ICE_P(x) \
   4     (__builtin_types_compatible_p(typeof(0?((void*)((long)(x)*0l)):(int*)1),int*))
   5 
   6 #define T(x)            __builtin_choose_expr(ICE_P(x), 1, 0)
   7 #define TEST(x, r)      _Static_assert(T(x) == r, #x " => " #r)
   8 
   9 static void test(int n)
  10 {
  11         char foo[n++];
  12 
  13         TEST(sizeof(foo), 0);
  14 }
  15 
  16 /*
  17  * check-name: vla-sizeof-ice
  18  * check-command: sparse -Wno-vla $file
  19  */