1 2 3void test(void (*fun)(void)); 4void test(void (*fun)(void)) 5{ 6 typedef typeof(__builtin_trap) t; // OK 7 void (*f)(void); 8 int i; 9 10 f = __builtin_trap; 11 f = &__builtin_trap; 12 f = *__builtin_trap; // OK for GCC 13 f = __builtin_trap + 0; 14 f = __builtin_trap + 1; 15 f = __builtin_trap - 1; 16 17 // (void) __builtin_trap; 18 f = (void*) __builtin_trap; 19 f = (unsigned long) __builtin_trap; 20 21 i = !__builtin_trap; 22 i = (__builtin_trap > fun); 23 i = (__builtin_trap == fun); 24 i = (fun < __builtin_trap); 25 i = (fun == __builtin_trap); 26 27 __builtin_trap - fun; 28 fun - __builtin_trap; 29} 30 31/* 32 * check-name: builtin arithmetic 33 * check-command: sparse -Wno-decl $file 34 * 35 * check-error-start 36builtin-arith.c:10:14: error: taking the address of built-in function '__builtin_trap' 37builtin-arith.c:11:13: error: taking the address of built-in function '__builtin_trap' 38builtin-arith.c:12:14: error: taking the address of built-in function '__builtin_trap' 39builtin-arith.c:13:14: error: taking the address of built-in function '__builtin_trap' 40builtin-arith.c:13:29: error: arithmetics on pointers to functions 41builtin-arith.c:14:14: error: taking the address of built-in function '__builtin_trap' 42builtin-arith.c:14:29: error: arithmetics on pointers to functions 43builtin-arith.c:15:14: error: taking the address of built-in function '__builtin_trap' 44builtin-arith.c:15:29: error: arithmetics on pointers to functions 45builtin-arith.c:18:21: error: taking the address of built-in function '__builtin_trap' 46builtin-arith.c:19:29: error: taking the address of built-in function '__builtin_trap' 47builtin-arith.c:21:14: error: taking the address of built-in function '__builtin_trap' 48builtin-arith.c:22:14: error: taking the address of built-in function '__builtin_trap' 49builtin-arith.c:23:14: error: taking the address of built-in function '__builtin_trap' 50builtin-arith.c:24:21: error: taking the address of built-in function '__builtin_trap' 51builtin-arith.c:25:21: error: taking the address of built-in function '__builtin_trap' 52builtin-arith.c:27:9: error: taking the address of built-in function '__builtin_trap' 53builtin-arith.c:27:24: error: subtraction of functions? Share your drugs 54builtin-arith.c:28:15: error: taking the address of built-in function '__builtin_trap' 55builtin-arith.c:28:13: error: subtraction of functions? Share your drugs 56 * check-error-end 57 */ 58