Debian Codegraph @

clang/test/Analysis/fixed-point.c

raw
1 // RUN: %clang_analyze_cc1 -ffixed-point \
2 // RUN: -analyzer-checker=core,debug.ExprInspection -verify %s
3
4 // expected-no-diagnostics
5
6 // Check that getAPSIntType does not crash
7 // when using fixed point types.
8
9 enum Kind { en_0 = 1 };
10
11 void _enum(int c) {
12 (void)((enum Kind) c >> 4);
13 }
14
15 void _inttype(int c) {
16 (void)(c >> 4);
17 }
18
19 void _accum(int c) {
20 (void)((_Accum) c >> 4);
21 }
22
23 void _fract(int c) {
24 (void)((_Fract) c >> 4);
25 }
26
27 void _long_fract(int c) {
28 (void)((long _Fract) c >> 4);
29 }
30
31 void _unsigned_accum(int c) {
32 (void)((unsigned _Accum) c >> 4);
33 }
34
35 void _short_unsigned_accum(int c) {
36 (void)((short unsigned _Accum) c >> 4);
37 }
38
39 void _unsigned_fract(int c) {
40 (void)((unsigned _Fract) c >> 4);
41 }
42
43 void sat_accum(int c) {
44 (void)((_Sat _Accum) c >> 4);
45 }
46
47 void sat_fract(int c) {
48 (void)((_Sat _Fract) c >> 4);
49 }
50
51 void sat_long_fract(int c) {
52 (void)((_Sat long _Fract) c >> 4);
53 }
54
55 void sat_unsigned_accum(int c) {
56 (void)((_Sat unsigned _Accum) c >> 4);
57 }
58
59 void sat_short_unsigned_accum(int c) {
60 (void)((_Sat short unsigned _Accum) c >> 4);
61 }
62
63 void sat_unsigned_fract(int c) {
64 (void)((_Sat unsigned _Fract) c >> 4);
65 }