sval: extra: type information was being lost in ++/-- operations
[smatch.git] / validation / typesign.c
blobe5dc525afff2ffd2891f435f21df932018ed9aa7
1 static unsigned int * s_to_u_return(signed int *sp)
3 return sp;
6 static signed int * u_to_s_return(unsigned int *up)
8 return up;
11 static unsigned int * s_to_u_init(signed int *sp)
13 unsigned int *up = sp;
14 return up;
17 static signed int * u_to_s_init(unsigned int *up)
19 signed int *sp = up;
20 return sp;
23 static unsigned int * s_to_u_assign(signed int *sp)
25 unsigned int *up;
26 up = sp;
27 return up;
30 static signed int * u_to_s_assign(unsigned int *up)
32 signed int *sp;
33 sp = up;
34 return sp;
38 * check-name: -Wtypesign
39 * check-command: sparse -Wtypesign $file
41 * check-error-start
42 typesign.c:3:16: warning: incorrect type in return expression (different signedness)
43 typesign.c:3:16: expected unsigned int *
44 typesign.c:3:16: got signed int *sp
45 typesign.c:8:16: warning: incorrect type in return expression (different signedness)
46 typesign.c:8:16: expected signed int *
47 typesign.c:8:16: got unsigned int *up
48 typesign.c:13:28: warning: incorrect type in initializer (different signedness)
49 typesign.c:13:28: expected unsigned int *up
50 typesign.c:13:28: got signed int *sp
51 typesign.c:19:26: warning: incorrect type in initializer (different signedness)
52 typesign.c:19:26: expected signed int *sp
53 typesign.c:19:26: got unsigned int *up
54 typesign.c:26:12: warning: incorrect type in assignment (different signedness)
55 typesign.c:26:12: expected unsigned int *up
56 typesign.c:26:12: got signed int *sp
57 typesign.c:33:12: warning: incorrect type in assignment (different signedness)
58 typesign.c:33:12: expected signed int *sp
59 typesign.c:33:12: got unsigned int *up
60 * check-error-end