-
Notifications
You must be signed in to change notification settings - Fork 25
Several fixes for SV-COMP #172
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
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
319327d
SSA: fix getting location from symbol
viktormalik e1ba240
Support --values-refine with --k-induction
viktormalik 029dece
Do not use std-invariants with k-induction
viktormalik 9bf6ad4
Split dynamic objects right after they are created
viktormalik 544ee60
Arrays: clear renamings if no template is built
viktormalik fb65271
Update the CBMC submodule
viktormalik 830b06e
Make user input non-deterministic
FrNecas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
CORE | ||
main.c | ||
--heap --values-refine --k-induction | ||
--heap --intervals --k-induction | ||
^EXIT=10$ | ||
^SIGNAL=0$ | ||
^VERIFICATION FAILED$ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
CORE | ||
main.c | ||
--k-induction | ||
--k-induction --std-invariants | ||
^EXIT=10$ | ||
^SIGNAL=0$ | ||
^.*FAILURE$ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
CORE | ||
main.c | ||
--k-induction | ||
--k-induction --std-invariants | ||
^EXIT=10$ | ||
^SIGNAL=0$ | ||
^.*FAILURE$ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
CORE | ||
main.c | ||
--k-induction | ||
--k-induction --std-invariants | ||
^EXIT=10$ | ||
^SIGNAL=0$ | ||
^.*FAILURE$ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
default: tests.log | ||
|
||
FLAGS = --verbosity 10 | ||
|
||
test: | ||
@../test.pl -p -c "../../../src/2ls/2ls $(FLAGS)" | ||
|
||
tests.log: ../test.pl | ||
@../test.pl -p -c "../../../src/2ls/2ls $(FLAGS)" | ||
|
||
show: | ||
@for dir in *; do \ | ||
if [ -d "$$dir" ]; then \ | ||
vim -o "$$dir/*.c" "$$dir/*.out"; \ | ||
fi; \ | ||
done; | ||
|
||
clean: | ||
@rm -f *.log | ||
@for dir in *; do rm -f $$dir/*.out; done; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Inspired by SV-comp: | ||
// https://sv-comp.sosy-lab.org/2023/results/sv-benchmarks/c/Juliet_Test/CWE190_Integer_Overflow__int64_t_fscanf_add_01_bad.i | ||
|
||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <time.h> | ||
|
||
void printLine(const char * line); | ||
void printLongLine(long longNumber); | ||
|
||
void CWE190_Integer_Overflow__int64_t_fscanf_add_01_bad() | ||
{ | ||
int64_t data; | ||
data = 0LL; | ||
fscanf (stdin, "%" "l" "d", &data); | ||
{ | ||
int64_t result = data + 1; | ||
printLongLongLine(result); | ||
} | ||
} | ||
int main(int argc, char * argv[]) | ||
{ | ||
srand( (unsigned)time(((void *)0)) ); | ||
printLine("Calling bad()..."); | ||
CWE190_Integer_Overflow__int64_t_fscanf_add_01_bad(); | ||
printLine("Finished bad()"); | ||
return 0; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
CORE | ||
main.c | ||
--signed-overflow-check | ||
^EXIT=10$ | ||
^SIGNAL=0$ | ||
^VERIFICATION FAILED$ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// Inspired by SV-comp: | ||
// https://sv-comp.sosy-lab.org/2023/results/sv-benchmarks/c/Juliet_Test/CWE190_Integer_Overflow__int64_t_fscanf_add_01_good.i | ||
|
||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <time.h> | ||
|
||
void printLine(const char * line); | ||
void printLongLine(long longNumber); | ||
void printLongLongLine(int64_t longLongIntNumber); | ||
|
||
static void goodG2B() | ||
{ | ||
int64_t data; | ||
data = 0LL; | ||
data = 2; | ||
{ | ||
int64_t result = data + 1; | ||
printLongLongLine(result); | ||
} | ||
} | ||
static void goodB2G() | ||
{ | ||
int64_t data; | ||
data = 0LL; | ||
fscanf (stdin, "%" "l" "d", &data); | ||
if (data < 0x7fffffffffffffffLL) | ||
{ | ||
int64_t result = data + 1; | ||
printLongLongLine(result); | ||
} | ||
else | ||
{ | ||
printLine("data value is too large to perform arithmetic safely."); | ||
} | ||
} | ||
void CWE190_Integer_Overflow__int64_t_fscanf_add_01_good() | ||
{ | ||
goodG2B(); | ||
goodB2G(); | ||
} | ||
int main(int argc, char * argv[]) | ||
{ | ||
srand( (unsigned)time(((void *)0)) ); | ||
printLine("Calling good()..."); | ||
CWE190_Integer_Overflow__int64_t_fscanf_add_01_good(); | ||
printLine("Finished good()"); | ||
return 0; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
CORE | ||
main.c | ||
--signed-overflow-check | ||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
^VERIFICATION SUCCESSFUL$ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Not for this PR) Shouldn't this rather have a fix in CBMC's models library?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC I saw Michael fixing this in CBMC so it should already be fixed, we just need to update again, so this is a temporary workaround :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought about cherry-picking that fix to our fork, but I don't think it would have been that straight forward, there were more changes in the source code of C function models.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, then we can revert on the next CBMC prerequisites upgrade.