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