db/fixup_kernel.sh: fix clear_user() handling
[smatch.git] / validation / builtin-arith.c
blob3ce593045b377b8ed8f96496ba6831d3cb858219
3 void test(void (*fun)(void));
4 void test(void (*fun)(void))
6 typedef typeof(__builtin_trap) t; // OK
7 void (*f)(void);
8 int i;
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;
17 // (void) __builtin_trap;
18 f = (void*) __builtin_trap;
19 f = (unsigned long) __builtin_trap;
21 i = !__builtin_trap;
22 i = (__builtin_trap > fun);
23 i = (__builtin_trap == fun);
24 i = (fun < __builtin_trap);
25 i = (fun == __builtin_trap);
27 __builtin_trap - fun;
28 fun - __builtin_trap;
32 * check-name: builtin arithmetic
33 * check-command: sparse -Wno-decl $file
35 * check-error-start
36 builtin-arith.c:10:14: error: taking the address of built-in function '__builtin_trap'
37 builtin-arith.c:11:13: error: taking the address of built-in function '__builtin_trap'
38 builtin-arith.c:12:14: error: taking the address of built-in function '__builtin_trap'
39 builtin-arith.c:13:14: error: taking the address of built-in function '__builtin_trap'
40 builtin-arith.c:13:29: error: arithmetics on pointers to functions
41 builtin-arith.c:14:14: error: taking the address of built-in function '__builtin_trap'
42 builtin-arith.c:14:29: error: arithmetics on pointers to functions
43 builtin-arith.c:15:14: error: taking the address of built-in function '__builtin_trap'
44 builtin-arith.c:15:29: error: arithmetics on pointers to functions
45 builtin-arith.c:18:21: error: taking the address of built-in function '__builtin_trap'
46 builtin-arith.c:19:29: error: taking the address of built-in function '__builtin_trap'
47 builtin-arith.c:21:14: error: taking the address of built-in function '__builtin_trap'
48 builtin-arith.c:22:14: error: taking the address of built-in function '__builtin_trap'
49 builtin-arith.c:23:14: error: taking the address of built-in function '__builtin_trap'
50 builtin-arith.c:24:21: error: taking the address of built-in function '__builtin_trap'
51 builtin-arith.c:25:21: error: taking the address of built-in function '__builtin_trap'
52 builtin-arith.c:27:9: error: taking the address of built-in function '__builtin_trap'
53 builtin-arith.c:27:24: error: subtraction of functions? Share your drugs
54 builtin-arith.c:28:15: error: taking the address of built-in function '__builtin_trap'
55 builtin-arith.c:28:13: error: subtraction of functions? Share your drugs
56 * check-error-end