Skip to content

Variable sensitivity domain #5472

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 342 commits into from
Nov 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
342 commits
Select commit Hold shift + click to select a range
9d6ed2d
Fixed bug when doing a merge write to a pointer
Apr 11, 2017
c02621e
Reworked the double dispatch of the merge
Apr 21, 2017
22c5a8d
Removing default copy constructors
Apr 21, 2017
4472561
Replacing map based switch statments with chained if/elses
Apr 24, 2017
13a4508
Explained why top must be used as the else clause in eval
Apr 24, 2017
4e18469
Don't make copies unnecessarily when merging
Apr 25, 2017
8a04c6e
Using enable_shared_from_this to eliminate naked pointers
Apr 25, 2017
579a84b
Adding unit tests for merging of abstract objects
Apr 25, 2017
13dceae
Fixed bugs revealed by unit tests
Apr 25, 2017
a25a039
Adding unit tests for constant abstract object.
Apr 25, 2017
db1d258
Adding tests for constant array
Apr 27, 2017
9303f9b
Adding unit tests for the struct abstract object
Apr 28, 2017
1bc8f48
Corrected merge methods for pointer and struct
Apr 28, 2017
4f4443a
Rewriting the constant_abstract_value::merge using behaviour driven d…
Apr 28, 2017
478d5df
Replaced assert with __CPROVER_assert
May 2, 2017
6955e2d
Use Behaviour Driven Design testing for abstract object merge
May 5, 2017
331967f
Struct and array AO unit tests using behaviour driven design
May 5, 2017
1a775e9
Corrected guard on specialised merge
May 5, 2017
3c2c184
Made pointer to array name consistent
May 5, 2017
19fa326
Constant array reading from top handled correctly
May 5, 2017
662f655
Completed test suite for full struct and constant array AOs
May 5, 2017
2fd13c4
Correctly set up the enviroment before running tests
May 9, 2017
c5ec42f
Extracted out logic for when to use a 2 value merge
May 11, 2017
da4250b
Improved comment in the LHS simplify
May 16, 2017
ccf5351
Fixed ai_simplify in variable sensitivity domain to use new interface
Jun 15, 2017
c4f1d52
Implemented the sensitivity domain for the union abstract object.
NlightNFotis Apr 10, 2017
5c83946
Added implementation for transition into/out of function calls
Mar 24, 2017
e71a2e7
Adding tests for function calls
Mar 24, 2017
e5b9fda
Added sound support for opaque functions
Apr 3, 2017
780c534
Adding reasonable behaviour for opqaue function calls
Apr 3, 2017
d40c459
Moved the function call handling into a separate method for readability
Apr 3, 2017
fcbc70d
Support for topping the global values
Apr 3, 2017
30f7e64
Assertion for varags
Apr 13, 2017
9667725
Made ai_simplify perform a partial simplifcation
Jun 15, 2017
a91626e
Corrected lhs simplification
Jun 27, 2017
9b10dd8
Adding tests for simplification of lhs
Jun 27, 2017
6c65dbc
Fixed constant propogation test
Jun 27, 2017
603e08f
Corrected code in base class and removed duplicate code
Jun 27, 2017
bb6ed40
Implementing a write_stack to represent writing to a addressable loca…
Jul 11, 2017
0afbfea
Use the write_stack in the constant_pointer_abstract_object
Jul 11, 2017
2dfa16e
Modified the write stack to not throw away certain pointers
Jul 12, 2017
fb63f24
Enable the write stack for pointers to structs
Jul 13, 2017
1da03e0
Enabling some of these assertions in tests related to arrays
Jul 13, 2017
6831a94
Correctly identify bitfield constants as CONSTANT values
chrisr-diffblue Oct 25, 2017
0ebc7ec
Driveby cleanup to keep Lint happy
chrisr-diffblue Oct 25, 2017
cb82f55
Add initial output functions for all sub-classes except pointer.
Jul 27, 2017
be961e7
Add method to update last_written_locations and used it provisionally…
Jul 27, 2017
5ff41ac
Experimental helper functions and an attempt to note destroy informat…
Jul 27, 2017
0ae3135
Initial merge implementation, some new helper functions (to be moved …
Jul 28, 2017
a5aad7e
Add erase methods and pointer handling.
Jul 28, 2017
316b9ae
Brief auxiliary function tidy-up
Jul 28, 2017
3616a1e
Finished prior to clean.
Jul 28, 2017
c6ae03e
Implemented "last written location" tracking abstract objects
Jul 28, 2017
2fa6938
Correction of Thomas's comments.
Jul 31, 2017
dc47ecf
Extracted the output method for locationst (into environment class, d…
Jul 31, 2017
17155db
To provide a fix for recursive assignments.
Jul 31, 2017
40883ba
Initial set of tests with manual human inspection. Moved static out…
Aug 1, 2017
1a02d3f
Correction of formatting (function call over multiple lines).
Aug 1, 2017
7358d10
First version of the function that searches two environments for modi…
NlightNFotis Aug 15, 2017
bb6a829
[WIP] Added more tests.
NlightNFotis Aug 16, 2017
4572d1f
Temporary commit for using the modified values
Aug 16, 2017
c063eaf
Implementing a write_stack to represent writing to a addressable loca…
Aug 17, 2017
33f29f2
Another temp checkin of where we've got to
Aug 18, 2017
4dc4c44
Adding get_modified_symbols to other domainTs
Aug 21, 2017
9479a93
Restored the correct modified symbols
Aug 21, 2017
6608e83
[WIP] Added the restore domain function.
NlightNFotis Aug 21, 2017
5702a32
Use the restore_domain function to do context sensitive func return
Aug 21, 2017
90b6e6b
Added a test for the variable sensitivity assign aware merge, for the…
NlightNFotis Aug 22, 2017
73db594
Added more tests for variable sensitivity assign aware merge for func…
NlightNFotis Aug 22, 2017
89d5c0b
Added more tests for variable sensitivity assign aware merge for func…
NlightNFotis Aug 22, 2017
eac3fe1
Added a basic file for array tests. Need thomas to config its validit…
NlightNFotis Aug 22, 2017
38d0b57
Added a struct c test file, and made some changes to the array testin…
NlightNFotis Aug 22, 2017
9f65c17
Added some changes that thomas made on my machine to test arrays modi…
NlightNFotis Aug 22, 2017
7c2efd9
Added the test.desc files for tests of arrays and structs.
NlightNFotis Aug 23, 2017
4dd8711
Fixing comment
Aug 23, 2017
125b44a
Correctly escaping braces
Aug 23, 2017
ac65156
Delete incorrect comment and fixing whitespace bug
Aug 23, 2017
24b3c7a
Update the last written location for structs
Aug 23, 2017
3bce160
Fixed typo introduced in test
Aug 23, 2017
14169e0
Add any elements that are only in the second map since this is modified
Aug 23, 2017
de8b655
Updated array test to test exactly what we want
Aug 23, 2017
f054366
Fixed the struct test.desc
NlightNFotis Aug 23, 2017
36d91d8
Three way merge initial checkin
Aug 23, 2017
078bcb9
Added tests for goto after function.
NlightNFotis Aug 23, 2017
dc7d9f0
Added tests for the non-terminating function case.
NlightNFotis Aug 23, 2017
4a2f147
Reworked three way merge that works when enabled and not
Aug 23, 2017
44c3936
Tidied up the changes introduced by context aware merging
Aug 24, 2017
c9f3816
Tweak to cope with missing utility function.
Dec 6, 2017
4ca731b
Fix up the last written location sensitivity tests.
Dec 6, 2017
c02a0a7
Add a common interface for read/write operations on abstract_objectt's
chrisr-diffblue Jan 18, 2018
dd35cb1
Avoid direct manipulation of abstract_objectt::top
chrisr-diffblue Jan 18, 2018
c3d14e7
Factor out last_written_location into it's own abstract_objectt
chrisr-diffblue Jan 18, 2018
76e3014
Factor out 'is_modified' logic into to the abstract_object implementa…
chrisr-diffblue Jan 11, 2018
a7254f5
Refactor and rename update_last_written_locations to be more generic
chrisr-diffblue Jan 18, 2018
2b316b5
Fixup variable-sensitivity unit tests to build after the giant rebase.
chrisr-diffblue Feb 14, 2018
e9bebea
Convert assertions to invariants.
Mar 13, 2018
dabc8e4
Fix a crashing bug with type comparison.
Mar 13, 2018
ab1c880
Allows simplification of expressions containing non-const
hannes-steffenhagen-diffblue Dec 11, 2017
5052882
Test case for the evaluation of (false && x) in the variable sensitiv…
Mar 13, 2018
7ef217a
Crashing test cases due to pointer arithmetic issues.
Mar 13, 2018
ba05bd5
Use sharing_mapt instead of std::map in full_struct_abstract_object
chrisr-diffblue Mar 13, 2018
f09fa4b
Use sharing_mapt for abstract environment
hannes-steffenhagen-diffblue Mar 14, 2018
96ebc78
Fix a silly double call of visitor.visit() in full_struct_abstract_ob…
chrisr-diffblue Mar 19, 2018
71b99c4
Use sharing_mapt in constant_array_abstract_objectt
Mar 18, 2018
cb5fdf2
Remove deprecated call to negate.
Mar 19, 2018
fb670ad
Avoid unnecessarily breaking sharing
hannes-steffenhagen-diffblue Mar 20, 2018
e5c1aa4
CLEANUP: Correct indentation
chrisr-diffblue Apr 18, 2018
95a8744
CLEANUP: Remove unneeded include of full_struct_abstract_object.h
chrisr-diffblue Apr 19, 2018
987f6db
CLEANUP: Correct authorship of dependency_context_abstract_object
chrisr-diffblue Apr 19, 2018
224c6dc
CLEANUP: Make constant_array_abstract_object match full_struct_abstra…
chrisr-diffblue Apr 24, 2018
ab5ebd4
CLEANUP: Move dump_map utility functions to the correct .cpp file
chrisr-diffblue Apr 25, 2018
971b020
REFACTOR: Rename dependency_context_abstract_object to write_location…
chrisr-diffblue Apr 18, 2018
9bdb201
REFACTOR: Refactor variable sensitivity write_location_context
chrisr-diffblue Apr 19, 2018
b503ec9
Record struct initialisation when field sensitivity is turned on
chrisr-diffblue Apr 18, 2018
b62e46d
Adjust float expression in variable sensitivity domain
hannes-steffenhagen-diffblue Apr 17, 2018
9ce32a8
Try all rounding modes when rounding mode is unknown
hannes-steffenhagen-diffblue Apr 25, 2018
44b00c6
Add floating point simplifcation test
hannes-steffenhagen-diffblue Apr 25, 2018
67d799b
Add data-dependency-context to variable sensitivity as commandline op…
chrisr-diffblue Apr 18, 2018
9332c86
Add variable sensitivity data dependency graph
chrisr-diffblue Apr 24, 2018
53705fa
[DO NOT MERGE] Track which expressions give rise to data dependencies
chrisr-diffblue Apr 25, 2018
b4dbd08
Avoid breaking sharing in usage of sharing_mapt in full_struct_abstra…
chrisr-diffblue Apr 30, 2018
6433744
Avoid breaking sharing in usage of sharing_mapt in constant_array_abs…
chrisr-diffblue Apr 30, 2018
c8928fc
Add data dependency context and variable sensitivity dependence graph…
danpoe May 10, 2018
29b1b80
Remove stray ; in context abstract object
danpoe May 10, 2018
50a7177
Interval values
Dec 8, 2019
8b5ee16
Add regression tests for interval abstract values
hannes-steffenhagen-diffblue May 10, 2018
2b05e2b
Various code style fixes in intervals code
Dec 8, 2019
0f3d70f
Move interval value constructors to .cpp
hannes-steffenhagen-diffblue May 22, 2018
c6d8327
Fix interval abstract value constructor
NlightNFotis May 24, 2018
41b5d22
Fix infinite loop in interval values
NlightNFotis May 24, 2018
75de207
Moved rounding mode aware arithmetic to constant abstract value
danpoe May 24, 2018
e0ec697
Calling eval_expression on top abstract object
danpoe May 24, 2018
6dfa185
Escape curly braces in variable sensitivity float regression test
danpoe May 25, 2018
391b0a6
Add struct case to abstract environment eval
danpoe May 25, 2018
3674800
Basic interval arithmetic
danpoe May 25, 2018
b60ba43
Interval arithmetic regression tests
danpoe May 29, 2018
2951a17
use eval to evaluate binary operators in interval abstract object
danpoe May 29, 2018
422741c
Handle typecasts in constant_interval_exprt
Dec 8, 2019
4193f50
Typecast from ID_bool to integer types
danpoe May 29, 2018
b6b550e
Addressing review comments
danpoe May 30, 2018
74eb120
Mark failing dependence graph test as FUTURE
danpoe May 25, 2018
e693693
Make constant_array_abstract_object::eval_index virtual
hannes-steffenhagen-diffblue May 22, 2018
1cb1f81
Move interval value constructors to .cpp
hannes-steffenhagen-diffblue May 22, 2018
00af48a
Interval operations
Dec 8, 2019
45a4376
Add interval arrays to variable sensitivity
hannes-steffenhagen-diffblue May 22, 2018
d4e3603
Clang format
hannes-steffenhagen-diffblue May 22, 2018
28f59b1
Return top in case of min/max indices in interval arrays
hannes-steffenhagen-diffblue May 30, 2018
f36936a
Exit loops in interval arrays early if result becomes top
hannes-steffenhagen-diffblue May 30, 2018
2a1459d
Use from_integer instead of constant_exprt constructor
hannes-steffenhagen-diffblue May 30, 2018
7ee14ae
Adapt dependence graph regression test to new output format
danpoe May 31, 2018
f5e6b12
Fixups to enable building after rebase
chrisr-diffblue Jul 6, 2018
66ae434
Add function to get statistics about variable sensitivity domain
hannes-steffenhagen-diffblue Jul 4, 2018
43f7e78
Add counts of various object types to environment statistics
hannes-steffenhagen-diffblue Jul 6, 2018
04758e4
Add an estimation of memory usage to object statistics
hannes-steffenhagen-diffblue Jul 10, 2018
aa2081b
Remove INVARIANT in full_struct_abstract_object copy constructor
chrisr-diffblue Jul 13, 2018
b66d8ef
Make variable-sensitivity dependence graph produce control dependencies
chrisr-diffblue Jul 13, 2018
a88eac1
Add support for bit field and enums intervals.cpp
chrisr-diffblue Jul 13, 2018
c9a6b53
Avoid creating interval_abstract_valuet's for float types
chrisr-diffblue Jul 13, 2018
29ecc3e
Add a basic implementation of to_constant for interval_abstract_valuet
chrisr-diffblue Jul 13, 2018
4335207
Crude ability to expression_transform mixed interval and non-intervals
chrisr-diffblue Jul 13, 2018
d05701c
Added regression test for variable sensitivity intervals with mixed f…
chrisr-diffblue Jul 13, 2018
be0d9a7
Include function call arguments in variable sensitivity dependency graph
chrisr-diffblue Jul 13, 2018
6bd5bfd
Move ai configuration to separate config object
Dec 8, 2019
6fe0f9c
Add option to print statistics about the VS domain
Dec 8, 2019
34aa619
Disable currently broken dependence graph tests
hannes-steffenhagen-diffblue Jul 20, 2018
bab158a
Disable interval float test
hannes-steffenhagen-diffblue Jul 23, 2018
50a135e
Fix variable sensitivity unit test
hannes-steffenhagen-diffblue Jul 24, 2018
cb759f7
Apply bandaid fix to variable sensitivity
Dec 8, 2019
fbcd383
Add control dependencies from function call to function entry point f…
danpoe Jul 26, 2018
010c0d8
Fix write_stack to correctly complete types for index_exprt expressions
chrisr-diffblue Jul 27, 2018
55811b9
Avoid breaking fixpoint when merging data_dependency_context
chrisr-diffblue Jul 27, 2018
091943f
Add specialised ai domain methods for variable sensitivity dependence…
danpoe Jul 31, 2018
64ec7fd
Control dependencies of function body instructions to function calls …
danpoe Aug 1, 2018
fb49437
Include GOTO guard expressions in variable sensitivity data dependencies
chrisr-diffblue Aug 1, 2018
a30aff6
Fix variable sensitivity dependence graph regression test
danpoe Aug 2, 2018
5f0484f
Ensure constant_array_abstract_object is in a valid state after calli…
chrisr-diffblue Aug 2, 2018
37260d4
Fix variable sensitvity to build with XCode 9
chrisr-diffblue Aug 8, 2018
918f319
Unconditional control dependency fix
chrisr-diffblue Aug 9, 2018
a7f7c75
Track only immediate dependencies in variable sensitivity dependence …
chrisr-diffblue Aug 8, 2018
27a8b21
Fix dependence graph precondition failure in VSB dependence graph
chrisr-diffblue Aug 10, 2018
06952e0
Initialise is_bottom in abstract_environmentt
hannes-steffenhagen-diffblue Aug 7, 2018
d108527
Fixup incorrect itterator comparison in data_dependency_context
chrisr-diffblue Aug 15, 2018
312b598
Add a module_dependencies.txt to variable sensitivity domain
chrisr-diffblue Aug 16, 2018
70bb1ce
Tools to build intersection of intervals satisfying bool expressions
Sep 7, 2018
312465b
Added regression test for PR #295
Sep 10, 2018
f73c94e
Extend interval multiplication for extremes
Dec 8, 2019
127c57c
Record data dependencies for functions with missing bodies
chrisr-diffblue Aug 22, 2018
961958b
Avoid setting domain to TOP when calling functions with const pointer…
chrisr-diffblue Aug 22, 2018
4d5b676
Merge when reading from array with unknown index.
Aug 24, 2018
f61fe5e
Fixups post-rebase
hannes-steffenhagen-diffblue Apr 26, 2018
aae01ec
Fix interval construction
petr-bauch Aug 16, 2019
38daf40
Support interval expressions containing ?: operations
chrisr-diffblue Nov 12, 2019
913d90e
Extend the interface with hashing and equality for unordered-sets.
owen-mc-diffblue Mar 11, 2020
6297b1c
Implement value sets
owen-mc-diffblue Mar 11, 2020
855cc06
If there is no context to wrap - don't wrap the objects
Mar 12, 2020
67f049c
Only enable location context if value set is turned off
Mar 12, 2020
bd84b45
Produce an error if value set is used with a context tracking argument
Mar 12, 2020
d569f4e
Remove unusued boolean flag
Mar 12, 2020
405eafb
Remove the way to set configuration options using only optionst
Mar 12, 2020
7ff4dc8
Introduce some sensible config defaults
Mar 12, 2020
366590e
Use the config to simplify the code
Mar 12, 2020
308a414
Make value set entries human-readable
owen-mc-diffblue Mar 23, 2020
c6e4237
Delete write_stack unit test
owen-mc-diffblue Mar 26, 2020
e24c17a
Various miscellaneous fixes
owen-mc-diffblue Mar 24, 2020
882addf
Add tests for value-set domain
Mar 12, 2020
7ec8050
Fix test and add reference to github issue.
NlightNFotis Apr 20, 2020
8fc8986
Make variable_sensitivity_domaint::eval public from protected
NlightNFotis Apr 30, 2020
bb211d1
Add stub implementations for value set classes
hannes-steffenhagen-diffblue May 22, 2020
22c7be1
clang-format everything
Jul 3, 2020
c6b69ba
Update test description for the move to __CPROVER_assert
Jul 4, 2020
c3482e5
Rather than change existing tests, create new test descriptions
Jul 4, 2020
8628e1b
Three way merge is not being added to ai_domaint so no override
Jul 4, 2020
73350b9
Use brace initialisation instead of parentheses
hannes-steffenhagen-diffblue May 26, 2020
cdc9e24
Implement merge for value_set_abstract_valuet
hannes-steffenhagen-diffblue May 26, 2020
1958427
Implement output for value-set abstract values
hannes-steffenhagen-diffblue May 28, 2020
a9326c6
Implement value_set_abstract_valuet::to_constant
hannes-steffenhagen-diffblue May 28, 2020
bc8ff68
Update the use of exprts so that it is more type safe
Jul 16, 2020
ab7010f
Disable stats collection until the necessary changes are merged to ait
Aug 4, 2020
a2780a5
Replace call to a utility function that is not in the patch set
Aug 4, 2020
951f9d6
Remove an unreachable fall back case
Aug 4, 2020
9a1a1de
Another update for the change in how three_way_merge is integrated
Aug 4, 2020
43b8b66
Port over some of the changes to dependence_graph to the VS version
Aug 4, 2020
2ca5cf7
fixup the unreachable thing
Aug 4, 2020
1fa8cff
Tweak the update to VSDG
Aug 4, 2020
c796ee0
Refactor the VS dependency graph analysis to use the domain factory
Aug 4, 2020
367d426
Fix all of the linting errors
Aug 4, 2020
d9cc8ac
Fix a very subtle bug in the initialisation of VSD domain objects
Aug 10, 2020
2ef5c1d
Integrate VSD so that it can be called from goto-analyzer
Aug 10, 2020
7c5c64a
Update the regression tests for the new arguments
Aug 10, 2020
8fe70c7
Re-enable dependency graph tests that were disabled at some point
Aug 17, 2020
88f7a74
Tidy up, fix and update the constant propagation tests (VSD and not)
Aug 17, 2020
78b849e
Make tests independent of the exact line numbers for assertions
Aug 18, 2020
ccdd452
Create a new abstract interpreter that does a three-way merge
Aug 18, 2020
f247dcb
Enable three-way merge for the tests that need it
Aug 24, 2020
dc7c4bd
Update line numbers for domains that track changes
Aug 24, 2020
74bc496
Use three-way merge in the VSD dependency graph
Aug 24, 2020
57e7d01
Update the VSD dependency graph tests for line number changes
Aug 24, 2020
516567f
Update unit tests for the improved, type safe(r) exprts
Aug 25, 2020
3322378
Tweak the VSDG to fix a clang specific warning about get_state
Aug 25, 2020
69d5367
One of the new unit tests was omitted from the source list
Aug 25, 2020
c8a3315
Update unit test for the bug fix to abstract_environmentt
Aug 25, 2020
593eec7
Correct a typo in the creation of an interval
Aug 25, 2020
8917763
Remove reference to non-public issue tracker
Aug 26, 2020
4608220
Convert comments to the new(er) doxygen format
Aug 27, 2020
3a1c7ca
Reformat so that comments pass linting
Sep 7, 2020
0d80676
Apply Peter Schrammel's review comments
Sep 7, 2020
12b273e
Move doxygen comments from .cpp to .h files
Sep 9, 2020
7a72940
Fix issues and warnings raised by doxygen
Sep 21, 2020
41606b0
Update regression tests to cope with changes to initialisation
Oct 19, 2020
22f775c
s/const auto/const auto &/ in loops
Nov 10, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
31 changes: 31 additions & 0 deletions regression/goto-analyzer-simplify/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

default: tests.log

test:
@if ! ../test.pl -c ../chain.sh ; then \
../failed-tests-printer.pl ; \
exit 1; \
fi

tests.log:
@if ! ../test.pl -c ../chain.sh ; then \
../failed-tests-printer.pl ; \
exit 1; \
fi

show:
@for dir in *; do \
if [ -d "$$dir" ]; then \
vim -o "$$dir/*.c" "$$dir/*.out"; \
fi; \
done;

clean:
@for dir in *; do \
rm -f tests.log; \
if [ -d "$$dir" ]; then \
cd "$$dir"; \
rm -f *.out *.gb; \
cd ..; \
fi \
done
14 changes: 14 additions & 0 deletions regression/goto-analyzer-simplify/chain.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

src_dir=../../../src

goto_analyzer=$src_dir/goto-analyzer/goto-analyzer

options=$1
file_name=${2%.c}

echo options: $options
echo file name : $file_name

$goto_analyzer $file_name.c $options --simplify $file_name_simp.out
$goto_analyzer $file_name_simp.out --show-goto-functions
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
extern int arr[];

void main()
{
int index = 0;
int j = arr[index];
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
CORE
main.c
"--variable-sensitivity --vsd-arrays"

arr\[0l\]
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
int nondet_int(void);

int main(void)
{
int r = nondet_int();
r = r + 1;
if(r == 2)
{
return 1;
}
return 0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
CORE
main.c
--variable-sensitivity
r == 2
^SIGNAL=0$
^EXIT=6$
--
--

Checks for a bug that occurred while changing the simplifier,
where a variable would be replaced by the RHS of its last assignment,
even if the value of that expression had changed since then;
Most egregiously when the RHS contained the symbol on the LHS (thus leading
to a recursive definition).
15 changes: 15 additions & 0 deletions regression/goto-analyzer-simplify/simplify-lhs-array-index/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
void main()
{
int arr[4] = {1, 2, 3, 4};

// No simplification
arr[0] = 1;

// Can simplify
int constant = 1;
arr[constant] = 2;

// No simplification
int nondet;
arr[nondet] = 3;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
CORE
main.c
"--variable-sensitivity --vsd-arrays"

arr\[0l\] =
arr\[1l\] =
arr\[\(signed long int\)nondet\] =
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
void main()
{
int symbol_a;
int symbol_b;

int nondet;
int *nondet_pointer;
if(nondet > 0)
{
nondet_pointer = &symbol_a;
}
else
{
nondet_pointer = &symbol_b;
}

int *arr[] = {&symbol_a, &symbol_b, nondet_pointer};

// Simplify the pointer
*arr[0] = 1;

// Simplify index and the pointer
int constant1 = 1;
*arr[constant1] = 2;

// Simplify the index but not the pointer
int constant2 = 2;
*arr[constant2] = 3;

// No simplification
int nondet_index;
*arr[nondet_index] = 4;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CORE
main.c
"--variable-sensitivity --vsd-arrays --vsd-pointers"

symbol_a = 1
symbol_b = 2
\*arr\[2l\] = 3;
\*arr\[\(signed long int\)nondet_index\] = 4;
22 changes: 22 additions & 0 deletions regression/goto-analyzer-simplify/simplify-lhs-dereference/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
void main()
{
int symbol;

int *pointer = &symbol;

// Simplify
*pointer = 5;

int nondet;
if(nondet > 0)
{
pointer = &nondet;
}
else
{
pointer = &symbol;
}

// No simplification
*pointer = 6;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
CORE
main.c
"--variable-sensitivity --vsd-pointers"

symbol = 5
\*pointer = 6
42 changes: 42 additions & 0 deletions regression/goto-analyzer-simplify/simplify-lhs-member/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
struct test_struct
{
int *pointer_component;
int array[5];
};

void main()
{
int symbol;

struct test_struct value;

// Simplify a pointer inside a struct
int symbol;
value.pointer_component = &symbol;

// Simplify
*value.pointer_component = 5;

int nondet;
if(nondet > 0)
{
value.pointer_component = &nondet;
}
else
{
value.pointer_component = &symbol;
}

// No simplification
*value.pointer_component = 6;

// Simplify an array

// Can simplify
int constant = 1;
value.array[constant] = 2;

// No simplification
int nondet;
value.array[nondet] = 3;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CORE
main.c
"--variable-sensitivity --vsd-arrays --vsd-pointers --vsd-structs"

symbol = 5
\*value\.pointer_component = 6
value\.array\[1l\] = 2
value\.array\[\(signed long int\)nondet\] = 3
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
void main()
{
int array[] = {1, 2, 3, 4, 5};

int *pointer = array;

// Simplify -> array[0] = 5
*pointer = 5;

int nondet;
pointer[nondet] = 6;

// TODO: Currently writing to an offset pointer sets the domain to top
// so recreate the variables to reign the domain back in
int new_array[] = {1, 2, 3, 4, 5};
int *new_pointer = new_array;

int constant = 1;
new_pointer[constant] = 7;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
CORE
main.c
"--variable-sensitivity --vsd-arrays --vsd-pointers"
array\[0l\] = 5
array\[\(signed long int\)nondet\] = 6
new_array\[1l\] = 7
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
int nondet_int(void);

int main(void)
{
int K = nondet_int();
int x = 0;
return K * x;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
CORE
main.c
"--variable-sensitivity"
^SIGNAL=0$
^EXIT=6$
main#return_value = 0;
--
--
Tests that a multiplication
of variable*variable can be simplified
if one of the variables can be evaluated to 0.
17 changes: 17 additions & 0 deletions regression/goto-analyzer/constant_assertions_01/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include <assert.h>

int nondet_int(void);

int main(int argc, char **argv)
{
int x = nondet_int();
int y = nondet_int();

__CPROVER_assert(0, "0");
__CPROVER_assert(0 && 1, "0 && 1");
__CPROVER_assert(0 || 0, "0 || 0");
__CPROVER_assert(0 && x, "0 && x");
__CPROVER_assert(y && 0, "y && 0");

return 0;
}
12 changes: 12 additions & 0 deletions regression/goto-analyzer/constant_assertions_01/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
CORE
main.c
--verify --variable-sensitivity
^\[main.assertion.1\] line 10 0: FAILURE \(if reachable\)$
^\[main.assertion.2\] line 11 0 && 1: FAILURE \(if reachable\)$
^\[main.assertion.3\] line 12 0 || 0: FAILURE \(if reachable\)$
^\[main.assertion.4\] line 13 0 && x: FAILURE \(if reachable\)$
^\[main.assertion.5\] line 14 y && 0: FAILURE \(if reachable\)$
^EXIT=0$
^SIGNAL=0$
--
^warning: ignoring
17 changes: 17 additions & 0 deletions regression/goto-analyzer/constant_assertions_02/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include <assert.h>

int nondet_int(void);

int main(int argc, char **argv)
{
int x = nondet_int();
int y = nondet_int();

__CPROVER_assert(1, "1");
__CPROVER_assert(0 || 1, "0 || 1");
__CPROVER_assert(1 && 1, "1 && 1");
__CPROVER_assert(1 || x, "1 || x");
__CPROVER_assert(y || 1, "y || 1");

return 0;
}
12 changes: 12 additions & 0 deletions regression/goto-analyzer/constant_assertions_02/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
CORE
main.c
--verify --variable-sensitivity
^\[main\.assertion\.1\] line 10 1: SUCCESS
^\[main\.assertion\.2\] line 11 0 || 1: SUCCESS
^\[main\.assertion\.3\] line 12 1 && 1: SUCCESS
^\[main\.assertion\.4\] line 13 1 || x: SUCCESS
^\[main\.assertion\.5\] line 14 y || 1: SUCCESS
^EXIT=0$
^SIGNAL=0$
--
^warning: ignoring
6 changes: 3 additions & 3 deletions regression/goto-analyzer/constant_propagation_01/main.c
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#include <assert.h>

int main()
{
int i, j=20;

if (j==20)
{
int x=1,y=2,z;
z=x+y;
assert(z==3);
__CPROVER_assert(z == 3, "z==3");
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
CORE
main.c
--variable-sensitivity --simplify out.gb
^EXIT=0$
^SIGNAL=0$
^Simplified: assert: 1, assume: 0, goto: 1, assigns: 7, function calls: 0$
^Unmodified: assert: 0, assume: 0, goto: 0, assigns: 17, function calls: 2$
--
^warning: ignoring
4 changes: 2 additions & 2 deletions regression/goto-analyzer/constant_propagation_02/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ int main()
{
int i=0, j=2;

if (i==0)
if(i == 0)
{
i++;
j++;
}
assert(j!=3);
__CPROVER_assert(j != 3, "j!=3");
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
CORE
main.c
--variable-sensitivity --simplify out.gb
^EXIT=0$
^SIGNAL=0$
^Simplified: assert: 1, assume: 0, goto: 1, assigns: 8, function calls: 0$
^Unmodified: assert: 0, assume: 0, goto: 0, assigns: 16, function calls: 2$
--
^warning: ignoring
Loading