atomic_inc_dec: improve how inc/dec is recorded in the DB
[smatch.git] / validation / typeof-safe.c
blob797c759f8b631897d3764225f688f3ff727def19
1 #define __safe __attribute__((safe))
3 static void test_safe(void)
5 int obj;
6 int __safe *ptr;
8 int __safe *ptr2 = ptr;
9 typeof(ptr) ptr3 = ptr;
10 typeof(*ptr) var2 = obj;
11 int __safe var3 = obj;
12 int *ptr4 = &obj;
13 int *ptr5 = ptr; // KO
15 typeof(*ptr) sobj;
16 typeof(&sobj) ptr6 = &obj;
17 typeof(&sobj) ptr7 = ptr; // KO
19 obj = obj;
20 ptr = ptr;
21 obj = *ptr;
22 ptr = (int __safe *) &obj;
26 * check-name: typeof-safe
28 * check-error-start
29 typeof-safe.c:13:21: warning: incorrect type in initializer (different modifiers)
30 typeof-safe.c:13:21: expected int *ptr5
31 typeof-safe.c:13:21: got int [safe] *ptr
32 typeof-safe.c:17:30: warning: incorrect type in initializer (different modifiers)
33 typeof-safe.c:17:30: expected int *ptr7
34 typeof-safe.c:17:30: got int [safe] *ptr
35 * check-error-end