Skip to content

Commit

Permalink
Merge pull request #1 from geoffw0/assignadd
Browse files Browse the repository at this point in the history
CPP: Tests for: Better overflow detection for AssignAdd/AssignSub
  • Loading branch information
kevinbackhouse authored May 17, 2019
2 parents 8cee18b + d2f386c commit 63794c8
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,23 @@
| test.c:398:22:398:22 | y | 5.0 |
| test.c:399:10:399:11 | y1 | 1.0 |
| test.c:399:15:399:16 | y2 | 5.0 |
| test.c:407:3:407:3 | i | -2.147483648E9 |
| test.c:408:7:408:7 | i | 10.0 |
| test.c:410:3:410:3 | i | -2.147483648E9 |
| test.c:411:3:411:3 | i | 10.0 |
| test.c:412:7:412:7 | i | -2.147483648E9 |
| test.c:414:3:414:3 | i | -2.147483648E9 |
| test.c:415:3:415:3 | i | 40.0 |
| test.c:416:7:416:7 | i | -2.147483648E9 |
| test.c:418:3:418:3 | i | -2.147483648E9 |
| test.c:418:7:418:7 | j | -2.147483648E9 |
| test.c:419:7:419:7 | i | 40.0 |
| test.c:421:3:421:3 | i | -2.147483648E9 |
| test.c:421:8:421:8 | j | 40.0 |
| test.c:422:7:422:7 | i | 50.0 |
| test.c:424:3:424:3 | i | -2.147483648E9 |
| test.c:424:13:424:13 | j | -2.147483648E9 |
| test.c:425:7:425:7 | i | -2.147483648E9 |
| test.cpp:10:7:10:7 | b | -2.147483648E9 |
| test.cpp:11:5:11:5 | x | -2.147483648E9 |
| test.cpp:13:10:13:10 | x | -2.147483648E9 |
Expand Down
26 changes: 26 additions & 0 deletions cpp/ql/test/library-tests/rangeanalysis/SimpleRangeAnalysis/test.c
Original file line number Diff line number Diff line change
Expand Up @@ -398,3 +398,29 @@ unsigned int test_comma01(unsigned int x) {
y2 = (y++, y += 3, y);
return y1 + y2;
}

void out(int i);

void test17() {
int i, j;

i = 10;
out(i); // 10

i = 10;
i += 10;
out(i); // 20

i = 40;
i -= 10;
out(i); // 30

i = j = 40;
out(i); // 40

i = (j += 10);
out(i); // 50

i = 20 + (j -= 10);
out(i); // 60
}
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,23 @@
| test.c:398:22:398:22 | y | 105.0 |
| test.c:399:10:399:11 | y1 | 101.0 |
| test.c:399:15:399:16 | y2 | 105.0 |
| test.c:407:3:407:3 | i | 2.147483647E9 |
| test.c:408:7:408:7 | i | 10.0 |
| test.c:410:3:410:3 | i | 2.147483647E9 |
| test.c:411:3:411:3 | i | 10.0 |
| test.c:412:7:412:7 | i | 2.147483647E9 |
| test.c:414:3:414:3 | i | 2.147483647E9 |
| test.c:415:3:415:3 | i | 40.0 |
| test.c:416:7:416:7 | i | 2.147483647E9 |
| test.c:418:3:418:3 | i | 2.147483647E9 |
| test.c:418:7:418:7 | j | 2.147483647E9 |
| test.c:419:7:419:7 | i | 40.0 |
| test.c:421:3:421:3 | i | 2.147483647E9 |
| test.c:421:8:421:8 | j | 40.0 |
| test.c:422:7:422:7 | i | 50.0 |
| test.c:424:3:424:3 | i | 2.147483647E9 |
| test.c:424:13:424:13 | j | 2.147483647E9 |
| test.c:425:7:425:7 | i | 2.147483647E9 |
| test.cpp:10:7:10:7 | b | 2.147483647E9 |
| test.cpp:11:5:11:5 | x | 2.147483647E9 |
| test.cpp:13:10:13:10 | x | 2.147483647E9 |
Expand Down

0 comments on commit 63794c8

Please sign in to comment.