Skip to content

Commit 63794c8

Browse files
Merge pull request #1 from geoffw0/assignadd
CPP: Tests for: Better overflow detection for AssignAdd/AssignSub
2 parents 8cee18b + d2f386c commit 63794c8

File tree

3 files changed

+60
-0
lines changed

3 files changed

+60
-0
lines changed

cpp/ql/test/library-tests/rangeanalysis/SimpleRangeAnalysis/lowerBound.expected

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,23 @@
423423
| test.c:398:22:398:22 | y | 5.0 |
424424
| test.c:399:10:399:11 | y1 | 1.0 |
425425
| test.c:399:15:399:16 | y2 | 5.0 |
426+
| test.c:407:3:407:3 | i | -2.147483648E9 |
427+
| test.c:408:7:408:7 | i | 10.0 |
428+
| test.c:410:3:410:3 | i | -2.147483648E9 |
429+
| test.c:411:3:411:3 | i | 10.0 |
430+
| test.c:412:7:412:7 | i | -2.147483648E9 |
431+
| test.c:414:3:414:3 | i | -2.147483648E9 |
432+
| test.c:415:3:415:3 | i | 40.0 |
433+
| test.c:416:7:416:7 | i | -2.147483648E9 |
434+
| test.c:418:3:418:3 | i | -2.147483648E9 |
435+
| test.c:418:7:418:7 | j | -2.147483648E9 |
436+
| test.c:419:7:419:7 | i | 40.0 |
437+
| test.c:421:3:421:3 | i | -2.147483648E9 |
438+
| test.c:421:8:421:8 | j | 40.0 |
439+
| test.c:422:7:422:7 | i | 50.0 |
440+
| test.c:424:3:424:3 | i | -2.147483648E9 |
441+
| test.c:424:13:424:13 | j | -2.147483648E9 |
442+
| test.c:425:7:425:7 | i | -2.147483648E9 |
426443
| test.cpp:10:7:10:7 | b | -2.147483648E9 |
427444
| test.cpp:11:5:11:5 | x | -2.147483648E9 |
428445
| test.cpp:13:10:13:10 | x | -2.147483648E9 |

cpp/ql/test/library-tests/rangeanalysis/SimpleRangeAnalysis/test.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,3 +398,29 @@ unsigned int test_comma01(unsigned int x) {
398398
y2 = (y++, y += 3, y);
399399
return y1 + y2;
400400
}
401+
402+
void out(int i);
403+
404+
void test17() {
405+
int i, j;
406+
407+
i = 10;
408+
out(i); // 10
409+
410+
i = 10;
411+
i += 10;
412+
out(i); // 20
413+
414+
i = 40;
415+
i -= 10;
416+
out(i); // 30
417+
418+
i = j = 40;
419+
out(i); // 40
420+
421+
i = (j += 10);
422+
out(i); // 50
423+
424+
i = 20 + (j -= 10);
425+
out(i); // 60
426+
}

cpp/ql/test/library-tests/rangeanalysis/SimpleRangeAnalysis/upperBound.expected

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,23 @@
423423
| test.c:398:22:398:22 | y | 105.0 |
424424
| test.c:399:10:399:11 | y1 | 101.0 |
425425
| test.c:399:15:399:16 | y2 | 105.0 |
426+
| test.c:407:3:407:3 | i | 2.147483647E9 |
427+
| test.c:408:7:408:7 | i | 10.0 |
428+
| test.c:410:3:410:3 | i | 2.147483647E9 |
429+
| test.c:411:3:411:3 | i | 10.0 |
430+
| test.c:412:7:412:7 | i | 2.147483647E9 |
431+
| test.c:414:3:414:3 | i | 2.147483647E9 |
432+
| test.c:415:3:415:3 | i | 40.0 |
433+
| test.c:416:7:416:7 | i | 2.147483647E9 |
434+
| test.c:418:3:418:3 | i | 2.147483647E9 |
435+
| test.c:418:7:418:7 | j | 2.147483647E9 |
436+
| test.c:419:7:419:7 | i | 40.0 |
437+
| test.c:421:3:421:3 | i | 2.147483647E9 |
438+
| test.c:421:8:421:8 | j | 40.0 |
439+
| test.c:422:7:422:7 | i | 50.0 |
440+
| test.c:424:3:424:3 | i | 2.147483647E9 |
441+
| test.c:424:13:424:13 | j | 2.147483647E9 |
442+
| test.c:425:7:425:7 | i | 2.147483647E9 |
426443
| test.cpp:10:7:10:7 | b | 2.147483647E9 |
427444
| test.cpp:11:5:11:5 | x | 2.147483647E9 |
428445
| test.cpp:13:10:13:10 | x | 2.147483647E9 |

0 commit comments

Comments
 (0)