Skip to content

Add tests for overflows #4209

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions regression/cbmc/Overflow_Addition2/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
void main()
{
signed char i, j;
i = j;
i++;
}
9 changes: 9 additions & 0 deletions regression/cbmc/Overflow_Addition2/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
CORE
main.c
--signed-overflow-check
^EXIT=10$
^SIGNAL=0$
^\[.*\] .* arithmetic overflow on signed \+ in .*: FAILURE$
^VERIFICATION FAILED$
--
^warning: ignoring
6 changes: 6 additions & 0 deletions regression/cbmc/Overflow_Addition3/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
void main()
{
signed char i, j;
i = j;
i += 1;
}
15 changes: 15 additions & 0 deletions regression/cbmc/Overflow_Addition3/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
KNOWNBUG
main.c
--signed-overflow-check --conversion-check
^EXIT=10$
^SIGNAL=0$
^\[.*\] .* arithmetic overflow on signed \+ in .*: SUCCESS
^\[.*\] .* arithmetic overflow on signed type conversion in .*: FAILURE$
^VERIFICATION FAILED$
--
^warning: ignoring
--
The addition is done in signed int; hence, the overflow is only detected
on conversion.

See #4208.
6 changes: 6 additions & 0 deletions regression/cbmc/Overflow_Addition4/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
void main()
{
signed char i, j;
i = j;
i = i + 1;
}
13 changes: 13 additions & 0 deletions regression/cbmc/Overflow_Addition4/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
CORE
main.c
--signed-overflow-check --conversion-check
^EXIT=10$
^SIGNAL=0$
^\[.*\] .* arithmetic overflow on signed \+ in .*: SUCCESS
^\[.*\] .* arithmetic overflow on signed type conversion in .*: FAILURE$
^VERIFICATION FAILED$
--
^warning: ignoring
--
The addition is done in signed int; hence, the overflow is only detected
on conversion.