Skip to content

Commit cc990f5

Browse files
authored
Merge pull request #6324 from diffblue/overflow_unsigned_unary_minus
Check overflow on unsigned unary minus
2 parents 942685c + 448421b commit cc990f5

19 files changed

+85
-33
lines changed

regression/cbmc/Overflow_Multiplication1/falsealarm.c

Lines changed: 0 additions & 13 deletions
This file was deleted.

regression/cbmc/Overflow_Leftshift1/test-c89.desc renamed to regression/cbmc/overflow/leftshift_overflow-c89.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
CORE
2-
main.c
2+
leftshift_overflow.c
33
--signed-overflow-check --c89
44
^EXIT=10$
55
^SIGNAL=0$

regression/cbmc/Overflow_Leftshift1/test-c99.desc renamed to regression/cbmc/overflow/leftshift_overflow-c99.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
CORE
2-
main.c
2+
leftshift_overflow.c
33
--signed-overflow-check --c99
44
^EXIT=10$
55
^SIGNAL=0$

regression/cbmc/Overflow_Leftshift1/main.c renamed to regression/cbmc/overflow/leftshift_overflow.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ int main()
88
unsigned r = x << ((sizeof(unsigned) - 1) * 8 + 1);
99

1010
// signed, owing to promotion, and cannot overflow
11-
r=x << ((sizeof(unsigned)-1)*8-1);
11+
r = x << ((sizeof(unsigned) - 1) * 8 - 1);
1212

1313
// unsigned
14-
r=(unsigned)x << ((sizeof(unsigned)-1)*8);
14+
r = (unsigned)x << ((sizeof(unsigned) - 1) * 8);
1515

1616
// negative value or zero, not an overflow
1717
int s = -x << ((sizeof(int) - 1) * 8);
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
int main() {
1+
int main()
2+
{
23
signed int i, j;
34

4-
i=j;
5+
i = j;
56

67
i++;
78
}

regression/cbmc/Overflow_Addition1/test.desc renamed to regression/cbmc/overflow/signed_addition_overflow1.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
CORE
2-
main.c
2+
signed_addition_overflow1.c
33
--signed-overflow-check
44
^EXIT=10$
55
^SIGNAL=0$

regression/cbmc/Overflow_Addition2/test.desc renamed to regression/cbmc/overflow/signed_addition_overflow2.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
CORE
2-
main.c
2+
signed_addition_overflow2.c
33
--signed-overflow-check
44
^EXIT=10$
55
^SIGNAL=0$

regression/cbmc/Overflow_Addition3/test.desc renamed to regression/cbmc/overflow/signed_addition_overflow3.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
CORE
2-
main.c
2+
signed_addition_overflow3.c
33
--signed-overflow-check --conversion-check
44
^EXIT=10$
55
^SIGNAL=0$

0 commit comments

Comments
 (0)