db/fixup_kernel.sh: fix clear_user() handling
[smatch.git] / validation / expand / builtin-expect.c
blob1b0c7c180f0c3cffb048c26c5f8ff61dc9cc7a06
1 int flia(long a)
3 return __builtin_expect(a, 1);
6 int flic(void)
8 return __builtin_expect(1L << 32 | 1, 1);
11 long fila(int a)
13 return __builtin_expect(a, 1);
16 long filc(void)
18 return __builtin_expect(1L << 32 | 1, 1);
21 long filu(void)
23 return __builtin_expect(0x80000000U, 1);
26 long fils(void)
28 return __builtin_expect((int)0x80000000, 1);
31 void *fptr(void *a)
33 return __builtin_expect(a, a);
37 * check-name: builtin-expect
38 * check-command: test-linearize -m64 -Wno-decl $file
39 * check-assert: sizeof(long) == 8
41 * check-output-start
42 flia:
43 .L0:
44 <entry-point>
45 trunc.32 %r2 <- (64) %arg1
46 ret.32 %r2
49 flic:
50 .L2:
51 <entry-point>
52 ret.32 $1
55 fila:
56 .L4:
57 <entry-point>
58 sext.64 %r6 <- (32) %arg1
59 ret.64 %r6
62 filc:
63 .L6:
64 <entry-point>
65 ret.64 $0x100000001
68 filu:
69 .L8:
70 <entry-point>
71 ret.64 $0x80000000
74 fils:
75 .L10:
76 <entry-point>
77 ret.64 $0xffffffff80000000
80 fptr:
81 .L12:
82 <entry-point>
83 ret.64 %arg1
86 * check-output-end
88 * check-error-start
89 expand/builtin-expect.c:33:33: warning: incorrect type in argument 1 (different base types)
90 expand/builtin-expect.c:33:33: expected long
91 expand/builtin-expect.c:33:33: got void *a
92 expand/builtin-expect.c:33:36: warning: incorrect type in argument 2 (different base types)
93 expand/builtin-expect.c:33:36: expected long
94 expand/builtin-expect.c:33:36: got void *a
95 expand/builtin-expect.c:33:32: warning: incorrect type in return expression (different base types)
96 expand/builtin-expect.c:33:32: expected void *
97 expand/builtin-expect.c:33:32: got long
98 expand/builtin-expect.c:8:42: warning: cast truncates bits from constant value (100000001 becomes 1)
99 * check-error-end