File tree Expand file tree Collapse file tree 2 files changed +34
-0
lines changed
c/cert/test/rules/INT32-C Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Original file line number Diff line number Diff line change 20
20
| test.c:146:5:146:11 | ... % ... | Operation % of type int may overflow or underflow. |
21
21
| test.c:147:5:147:12 | ... %= ... | Operation %= of type signed int may overflow or underflow. |
22
22
| test.c:161:3:161:5 | - ... | Operation - of type signed int may overflow or underflow. |
23
+ | test.c:173:3:173:6 | ... ++ | Operation ++ of type signed int may overflow or underflow. |
24
+ | test.c:189:3:189:6 | ... -- | Operation -- of type signed int may overflow or underflow. |
Original file line number Diff line number Diff line change @@ -167,4 +167,36 @@ void test_negate_precheck(signed int i1) {
167
167
} else {
168
168
- i1 ; // COMPLIANT
169
169
}
170
+ }
171
+
172
+ void test_inc (signed int i1 ) {
173
+ i1 ++ ; // NON_COMPLIANT
174
+ }
175
+
176
+ void test_inc_guard (signed int i1 ) {
177
+ if (i1 < INT_MAX ) {
178
+ i1 ++ ; // COMPLIANT
179
+ }
180
+ }
181
+
182
+ void test_inc_loop_guard () {
183
+ for (signed int i1 = 0 ; i1 < 10 ; i1 ++ ) { // COMPLIANT
184
+ // ...
185
+ }
186
+ }
187
+
188
+ void test_dec (signed int i1 ) {
189
+ i1 -- ; // NON_COMPLIANT
190
+ }
191
+
192
+ void test_dec_guard (signed int i1 ) {
193
+ if (i1 > INT_MIN ) {
194
+ i1 -- ; // COMPLIANT
195
+ }
196
+ }
197
+
198
+ void test_dec_loop_guard () {
199
+ for (signed int i1 = 10 ; i1 > 0 ; i1 -- ) { // COMPLIANT
200
+ // ...
201
+ }
170
202
}
You can’t perform that action at this time.
0 commit comments