File tree Expand file tree Collapse file tree 3 files changed +28
-19
lines changed Expand file tree Collapse file tree 3 files changed +28
-19
lines changed Original file line number Diff line number Diff line change 2929 lowerBound ( right ) < 0 or
3030 upperBound ( right ) > max_val
3131 )
32- select right , "The shift right hand operand shall lie in the range 0 to " + max_val + "."
32+ select right , "The right hand operand of the shift operator shall lie in the range 0 to " + max_val + "."
Original file line number Diff line number Diff line change 1- | test.c:8:10:8:10 | 8 | The shift right hand operand shall lie in the range 0 to 7. |
2- | test.c:10:10:10:14 | ... + ... | The shift right hand operand shall lie in the range 0 to 7. |
3- | test.c:11:10:11:14 | ... + ... | The shift right hand operand shall lie in the range 0 to 7. |
4- | test.c:15:9:15:9 | 8 | The shift right hand operand shall lie in the range 0 to 7. |
5- | test.c:20:9:20:10 | 64 | The shift right hand operand shall lie in the range 0 to 63. |
6- | test.c:23:10:23:11 | 10 | The shift right hand operand shall lie in the range 0 to 7. |
7- | test.c:24:10:24:11 | 64 | The shift right hand operand shall lie in the range 0 to 7. |
1+ | test.c:8:10:8:10 | 8 | The right hand operand of the shift operator shall lie in the range 0 to 7. |
2+ | test.c:9:10:9:11 | - ... | The right hand operand of the shift operator shall lie in the range 0 to 7. |
3+ | test.c:10:10:10:14 | ... + ... | The right hand operand of the shift operator shall lie in the range 0 to 7. |
4+ | test.c:11:10:11:14 | ... + ... | The right hand operand of the shift operator shall lie in the range 0 to 7. |
5+ | test.c:13:21:13:22 | 16 | The right hand operand of the shift operator shall lie in the range 0 to 15. |
6+ | test.c:16:9:16:9 | 8 | The right hand operand of the shift operator shall lie in the range 0 to 7. |
7+ | test.c:21:9:21:10 | 64 | The right hand operand of the shift operator shall lie in the range 0 to 63. |
8+ | test.c:25:10:25:10 | 8 | The right hand operand of the shift operator shall lie in the range 0 to 7. |
9+ | test.c:26:10:26:11 | 64 | The right hand operand of the shift operator shall lie in the range 0 to 7. |
10+ | test.c:30:16:30:17 | 64 | The right hand operand of the shift operator shall lie in the range 0 to 63. |
Original file line number Diff line number Diff line change 1+ #include <limits.h>
12#include <stdint.h>
2-
33void f1 () {
44 uint8_t ui8 ;
55 int b = 4 ;
66
7- ui8 << 7 ; // COMPLIANT
8- ui8 >> 8 ; // NON_COMPLIANT
9- ui8 << 3 + 3 ; // COMPLIANT
10- ui8 >> 4 + b ; // NON_COMPLIANT
11- ui8 << b + b ; // NON_COMPLIANT
12- (uint16_t ) ui8 << 9 ; // COMPLIANT
7+ ui8 << 7 ; // COMPLIANT
8+ ui8 >> 8 ; // NON_COMPLIANT
9+ ui8 >> -1 ; // NON_COMPLIANT
10+ ui8 >> 4 + b ; // NON_COMPLIANT
11+ ui8 << b + b ; // NON_COMPLIANT
12+ (uint16_t ) ui8 << 8 ; // COMPLIANT
13+ (uint16_t ) ui8 << 16 ; // NON_COMPLIANT
1314
1415 // 0u essential type is essentially unsigned char
1516 0u << 8 ; // NON_COMPLIANT
1617 (uint16_t )0u << 8 ; // COMPLIANT
1718
1819 unsigned long ul ;
19- ul << 10 ; // COMPLIANT
20+ ul << 8 ; // COMPLIANT
2021 ul << 64 ; // NON_COMPLIANT
2122
22- // 1UL essential type is essentially unsigned long
23- 1UL << 10 ; // COMPLIANT[FALSE_POSITIVE]
24- 1UL << 64 ; // NON_COMPLIANT
23+ // 1UL essential type is essentially unsigned char
24+ 1UL << 7 ; // COMPLIANT
25+ 1UL << 8 ; // NON_COMPLIANT
26+ 1UL << 64 ; // NON_COMPLIANT
27+
28+ // ULONG_MAX essential type is essentially unsigned long
29+ ULONG_MAX << 8 ; // COMPLIANT
30+ ULONG_MAX << 64 ; // NON_COMPLIANT
2531}
You can’t perform that action at this time.
0 commit comments