Skip to content
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

TUM Practical Course Summer 2023: Termination Analyses #1093

Merged
merged 419 commits into from
Nov 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
419 commits
Select commit Hold shift + click to select a range
af61d92
Merge branch 'recursion' of https://github.com/serenita/goblint-analy…
Jun 20, 2023
c6f37b2
added weird test case + merging
Jun 20, 2023
566ae50
Fix indentation
Jun 20, 2023
6cf3d12
Small changes
Jun 20, 2023
cfaf417
added location to recursion Warning
Jun 20, 2023
f309afd
Merge branch 'recursion' of https://github.com/serenita/goblint-analy…
Jun 20, 2023
b562cac
Merge branch 'master' into lagemann-dev
LageTs Jun 21, 2023
cb8d719
Merge branch 'recursion' into lagemann-dev
LageTs Jun 21, 2023
a4991e0
Adapted update_suite.rb and tests to termination output
LageTs Jun 21, 2023
7a6b18c
reverted test case
Jun 21, 2023
4a402ca
reverted test case
Jun 21, 2023
f35c116
pulled master
Jun 21, 2023
79ac4ba
fixed error that for only one function the analysis was not executed:…
Jun 21, 2023
6a4105d
Added SKIP/TODO functionality for loop termination
LageTs Jun 21, 2023
3e6ffcc
Merge branch 'recursion' into lagemann-dev
LageTs Jun 21, 2023
6f39218
Adapted TODO comments to current state
LageTs Jun 21, 2023
0f3dbdc
Comment out unused loop_heads function
Jun 21, 2023
1a09057
Answer queries with false when multi-threaded
Jun 21, 2023
524f0cb
Change comments
Jun 21, 2023
72062a6
Added requested test cases
LageTs Jun 21, 2023
05cb3f7
Merge branch 'master' of https://github.com/serenita/goblint-analyzer
Jun 22, 2023
2f9f697
Skip crashing tests
LageTs Jun 22, 2023
178c1ac
Merge branch 'master' into lagemann-dev
LageTs Jun 22, 2023
e250557
reverted test case 55 01
Jun 22, 2023
cf96d59
merging
Jun 22, 2023
4e66fd2
make recursion analysis optional (depending if loop ana is activated)
Jun 22, 2023
f467bab
Merge branch 'master' of https://github.com/serenita/goblint-analyzer…
Jun 22, 2023
d2fce9b
Merge branch 'master' of https://github.com/serenita/goblint-analyzer
Jun 22, 2023
4b4be5b
work-in-progress on svcomp integration
Jun 22, 2023
62d260f
handled warnings during make
Jun 22, 2023
3707652
indentation
Jun 22, 2023
f7dab71
indentation
Jun 22, 2023
5b0d72f
Indentation with ocp-indent
LageTs Jun 22, 2023
8a320eb
added sv-comp compatability
Jun 22, 2023
5bb821c
revert testchanges in option.schema.json
Jun 22, 2023
5d3f25c
Fix indentation
Jun 22, 2023
a6a1526
Merge redefinition of old termination with new loop/recursion termina…
LageTs Jun 26, 2023
fa71e4e
Merge remote-tracking branch 'upstream/master'
Jun 28, 2023
8603177
Fix indentation
Jun 28, 2023
d987f1a
Restore signs analysis tutorial
Jun 28, 2023
b1930ab
Simplify src/framework/analyses.ml
serenita Jun 28, 2023
a3fd8d0
Fix indentation
Jun 28, 2023
ba596d7
Remove build_testing.yml
Jun 28, 2023
fbef208
No skipping
LageTs Jun 29, 2023
13f369a
New non terminating for loop
LageTs Jun 29, 2023
d681158
Folder Renaming
LageTs Jun 29, 2023
541e49b
Enable polyhedra; Removed unnecessary TODOs
LageTs Jun 29, 2023
1b5db9c
patched loop termination check position to right after the loop head
Jun 29, 2023
e6ba559
removed temporary comment
Jun 29, 2023
30ecae7
Merge branch 'master' into lagemann-dev
LageTs Jun 29, 2023
16b8c37
removed outdated code
Jun 29, 2023
1cefa96
Removed unnecessary TODOs
LageTs Jun 29, 2023
2430f3f
Renamed LOCAL_TERM to TERM
LageTs Jun 29, 2023
1ec6bd6
Merge branch 'master' into lagemann-dev
LageTs Jun 29, 2023
2c73948
Reformat
LageTs Jun 29, 2023
7f484cb
Skip crashing tests
LageTs Jun 29, 2023
a91e716
Rename loop termination analysis
Jun 29, 2023
8483cec
Removed Todos
LageTs Jun 29, 2023
11122b3
Merge branch 'master' into lagemann-dev
LageTs Jun 29, 2023
91f18ef
Adapted tests to current state
LageTs Jun 29, 2023
1c43039
Adapted tests to current state
LageTs Jun 29, 2023
c890d5b
No skipping
LageTs Jun 29, 2023
569fefd
New non terminating for loop
LageTs Jun 29, 2023
aca1ec5
Folder Renaming
LageTs Jun 29, 2023
70bad4c
Enable polyhedra; Removed unnecessary TODOs
LageTs Jun 29, 2023
e70761c
Removed unnecessary TODOs
LageTs Jun 29, 2023
ee93929
Renamed LOCAL_TERM to TERM
LageTs Jun 29, 2023
d05da3a
Reformat
LageTs Jun 29, 2023
036dd17
Skip crashing tests
LageTs Jun 29, 2023
4cb5da0
Removed Todos
LageTs Jun 29, 2023
fec0d62
Adapted tests to current state
LageTs Jun 29, 2023
68b01af
Adapted tests to current state
LageTs Jun 29, 2023
529d70e
Merge remote-tracking branch 'upstream/master'
Jun 29, 2023
b7c6ec5
Restore apronAnalysis.apron.ml
Jun 29, 2023
432e92d
Explicitly use () as the abstract local state
Jun 29, 2023
2953242
Change let-in clause to sequential statements
Jun 29, 2023
c2c69cf
Update src/framework/constraints.ml
serenita Jun 29, 2023
d18d8fe
Update src/framework/constraints.ml
serenita Jun 29, 2023
0d77172
Remove unnecessary semicola
serenita Jun 29, 2023
76230f4
Restore 01-simple-cases.c from white space change
Jun 29, 2023
7706ac3
Merge branch 'master'
Jun 29, 2023
6e62041
adapted changes from pull request: 1. using a module for tuple; 2. de…
Jun 30, 2023
9c8d128
changed the order in C_Printable
Jun 30, 2023
c776d8c
changed naming for SV-Comp specification from NoTermination to Termin…
Jul 1, 2023
b1da8e2
renamed termination in control to termination_enabled; added comment …
Jul 2, 2023
1ace9d6
Add description to loop/goto termination analysis
Jul 3, 2023
30b03ce
Introduce isEverMultiThreaded analysis
Jul 3, 2023
e8aec04
Finish and use everMultiThreaded analysis
Jul 3, 2023
f8fa8e3
Revert whitespace change
Jul 3, 2023
4f60156
added missing __goblint_bounded implementations
Jul 3, 2023
21f2f34
Temp. revert must_be_single_threaded_since_start
Jul 3, 2023
048de26
Patched inconsistency with nested loops
Jul 5, 2023
1421775
Merge remote-tracking branch 'upstream/master'
Jul 6, 2023
b67eacd
Rename loop termation analysis
Jul 6, 2023
22efd12
changed name
Jul 6, 2023
4308bdb
Merge branch 'master' of https://github.com/serenita/goblint-analyzer
Jul 6, 2023
c5fe485
Remove unused code
Jul 6, 2023
094d564
Merge branch 'master' into lagemann-dev
LageTs Jul 6, 2023
b9a5c36
Tests adapted and new test 74/35
LageTs Jul 6, 2023
7e12cb5
Tests is now passing
LageTs Jul 6, 2023
bc7bef7
Restrict boundedness checking to postsolving
Jul 6, 2023
08ad8d0
Revert "Restrict boundedness checking to postsolving"
Jul 6, 2023
2e05e9e
Restrict boundedness checking to postsolving (fix)
Jul 6, 2023
0d79d2a
Widen recursion test
LageTs Jul 6, 2023
4459239
Merge branch 'lagemann-dev'
LageTs Jul 6, 2023
1190d63
Adapted test parameter
LageTs Jul 6, 2023
dbe3684
inlined Groupable C to Map
Jul 9, 2023
73b4f89
Merge branch 'master' of https://github.com/serenita/goblint-analyzer
Jul 9, 2023
5f11a50
Merge remote-tracking branch 'upstream/master'
Jul 9, 2023
68bf103
Rename query MustTermProg to MustTermAllLoops
Jul 9, 2023
fbc2966
Test moved and renamed
LageTs Jul 9, 2023
4a6714c
added comments to explain why test 74/28 does fail and why 30 and 35 …
Jul 9, 2023
852d065
Merge branch 'master' of https://github.com/serenita/goblint-analyzer
Jul 9, 2023
cb13d14
Tests moved
LageTs Jul 9, 2023
c6e36e4
cleaned module G from an unnecessary function; addded missing comment…
Jul 9, 2023
ff42a19
Merge branch 'lagemann-dev'
LageTs Jul 9, 2023
9d66846
Complex test adapted
LageTs Jul 9, 2023
ed01412
Merge branch 'master' into lagemann-dev
LageTs Jul 9, 2023
09ee872
moved warnings to loop analysis
Jul 10, 2023
83e31fc
Merge branch 'master' of https://github.com/serenita/goblint-analyzer
Jul 10, 2023
d6c11b6
Test refactoring & parameter correction
LageTs Jul 10, 2023
1faf729
added autoTune for termination analysis in mainGoblint.ml
Jul 10, 2023
d58f6c7
Merge branch 'master' of https://github.com/serenita/goblint-analyzer
Jul 10, 2023
43bf64d
temporarly removed sem.int.signed_overflow assume_none autotuning
Jul 10, 2023
5ef2664
Test indentation
LageTs Jul 10, 2023
d394d95
Merge branch 'master' into lagemann-dev
LageTs Jul 10, 2023
71b1eb2
Execute termination tests in CI even if skipped.
LageTs Jul 10, 2023
472a76c
added warning for multithreaded case
Jul 10, 2023
4af911a
Revert "added warning for multithreaded case"
Jul 10, 2023
32a654b
addedd the possibly non-terminating warning for multi threaded programs
Jul 10, 2023
d0fc53f
Merge remote-tracking branch 'upstream/master'
Jul 12, 2023
53c3c1c
Enable use of everMultiThreaded analysis
Jul 12, 2023
76486c9
Make struct for V anonymous
Jul 12, 2023
ba9d35a
indentation
Jul 13, 2023
a98f503
Test goal and comments changed
LageTs Jul 13, 2023
98c062a
Test indentation
LageTs Jul 10, 2023
4dd330c
Execute termination tests in CI even if skipped.
LageTs Jul 10, 2023
7e6ac43
Merge remote-tracking branch 'origin/lagemann-dev' into lagemann-dev
LageTs Jul 13, 2023
12ce13d
Merge remote-tracking branch 'upstream/master'
LageTs Jul 13, 2023
6c8152d
Merge branch 'master' into lagemann-dev
LageTs Jul 13, 2023
5f98417
Test explanation && new test case termination 43
LageTs Jul 13, 2023
76f540f
Test explanation && new test case termination 43
LageTs Jul 13, 2023
40ea15c
Added special function --Still work in progress
Jul 13, 2023
392c919
Merge branch 'master' of https://github.com/serenita/goblint-analyzer
Jul 13, 2023
30692fc
Test for code line detection
LageTs Jul 13, 2023
dc0a284
changed __goblint_bounded constructor from Assert to Bounded
Jul 13, 2023
c1153f7
Merge remote-tracking branch 'upstream/master'
Jul 14, 2023
1f499e9
Use special function instead of variable indicator
Jul 14, 2023
b9a5b3f
Clean up, make things look nicer
Jul 14, 2023
6146c76
Wrap always_single_threaded in let-in clause
Jul 14, 2023
847ea36
Remove PreProcessing exception
Jul 14, 2023
4087dfb
removed the trick to make C groupable due to #1112; deleted printXML …
Jul 14, 2023
bd58dc5
Merge remote-tracking branch 'upstream/master'
Jul 14, 2023
2f31211
Merge remote-tracking branch 'upstream/master'
Jul 15, 2023
0a9c5d4
Fix indentation
Jul 15, 2023
10260bd
Added more recursive tests
LageTs Jul 16, 2023
f8a2e53
Merge branch 'lagemann-dev'
LageTs Jul 16, 2023
4e36511
removed exit-indikator variable
Jul 16, 2023
d47e88e
removed debug print; Might solve cram tests
Jul 17, 2023
021ddad
Remove debug output
Jul 17, 2023
47440a3
Code style optimization
LageTs Jul 17, 2023
91d331d
Indentation
LageTs Jul 17, 2023
fc427bc
Fix indentation
Jul 17, 2023
3fb5d14
Test case 48
LageTs Jul 17, 2023
97d9c80
Merge branch 'master' of https://github.com/serenita/goblint-analyzer
Jul 18, 2023
8c2b4e0
Merge remote-tracking branch 'upstream/master'
Jul 18, 2023
601698f
Remove unused code; introduce basic error-handling
Jul 18, 2023
ed58098
Merge branch 'lagemann-dev'
LageTs Jul 18, 2023
66115b1
Annotate tests with skip as Apron ist used
LageTs Jul 24, 2023
ed97494
Merge remote-tracking branch 'upstream/master'
Jul 24, 2023
3c31cb7
Revert src/analyses/termination.ml
LageTs Jul 24, 2023
912431d
Merge remote-tracking branch 'upstream/master'
Jul 25, 2023
a9c9c7d
changed initial value of lcv to min int; swaped sequence of increment…
Jul 25, 2023
782b21c
Fix indentation
Jul 25, 2023
c53f0b8
Polish comments
Jul 26, 2023
cd8fae0
Merge remote-tracking branch 'upstream/master'
Jul 26, 2023
c52cf47
Remove runningGob.sh
Jul 26, 2023
867e6ca
Restore indentation; remove unused include Printf
Jul 26, 2023
0f94aaa
More indentation restoring
Jul 26, 2023
f4fd0c2
Fix a typo
Jul 26, 2023
1be8c9c
Remove goto stuff from loopTermination analysis
Jul 26, 2023
cf594b6
Add goto-fundec list in cilfacade.ml
Jul 26, 2023
eabf6b7
add gotos with their respective function to new list in Cilfacade
Jul 26, 2023
19addab
added code for control to only print upjumping goto message when goto…
Jul 26, 2023
7444dc9
Merge branch 'master' of https://github.com/serenita/goblint-analyzer
Jul 26, 2023
72e2e22
now everything should work :), now iterating over live_lines
Jul 26, 2023
6090c62
now without prints :)))
Jul 26, 2023
e96433b
Handle skipped (NON-)TERM-Tests other than TODO
LageTs Jul 26, 2023
e1f8319
Set sv-comp flag for upjumping gotos
michael-schwarz Aug 30, 2023
b832f31
Increase indentation in switch-case in update_suite.rb.
jerhard Sep 1, 2023
a6e4af4
Rename must_be_single_threaded_since_start to must_always_be_single_t…
jerhard Sep 1, 2023
7ba0fd3
Merge branch 'master' into term
michael-schwarz Oct 3, 2023
8be0343
Merge branch 'master' into term
michael-schwarz Oct 12, 2023
44b4492
Issue non-termination warning for `longjmp` calls
michael-schwarz Oct 12, 2023
ea38918
Include termination tests into `coverage` and `unlocked`
michael-schwarz Oct 12, 2023
e284953
Simplify global invariant
michael-schwarz Oct 12, 2023
7f3cadf
Adapt comments to simplified global invariant
michael-schwarz Oct 12, 2023
515a8bd
Simplify cycle detection
michael-schwarz Oct 12, 2023
b3016ff
Failwith meaningful message for invaliud calls to `__goblint_bounded`
michael-schwarz Oct 12, 2023
14c3ead
Merge branch 'master' into term
michael-schwarz Oct 14, 2023
5844552
Cleanup termination property
michael-schwarz Oct 14, 2023
7cca2cf
LTL for termination is `F end`
michael-schwarz Oct 14, 2023
268d86d
Merge branch 'master' into term
michael-schwarz Nov 1, 2023
a7d02c4
Simplify warning
michael-schwarz Nov 1, 2023
cf22550
Delete old termination analysis
michael-schwarz Nov 1, 2023
67cc037
Rm old Termination also from `goblint_lib.ml`
michael-schwarz Nov 1, 2023
dff7be0
Make `do_preprocess_cil` more efficient
michael-schwarz Nov 1, 2023
2d8fe09
Remove outdated TODO
michael-schwarz Nov 1, 2023
e690d9a
Prioritze termination warnings in `update_suite.rb`
michael-schwarz Nov 2, 2023
f024fd9
Merge branch 'master' into term
michael-schwarz Nov 2, 2023
fb92abc
Rename NonTerminating -> Termination
michael-schwarz Nov 10, 2023
aad465c
Autotune for Termination
michael-schwarz Nov 10, 2023
2ff979b
Simplify variable names
michael-schwarz Nov 10, 2023
b49356c
Deduplicate preprocessing
michael-schwarz Nov 10, 2023
490203d
Move `everMultiThreaded` to `threadflag`
michael-schwarz Nov 10, 2023
e25b708
Simplify `loopTermination`
michael-schwarz Nov 10, 2023
d4ab699
Fail when `termination` is active and incremental analysis is enabled
michael-schwarz Nov 10, 2023
47d0f5d
Termination: set `is_write_only`
michael-schwarz Nov 10, 2023
4417b9c
Reset `upjumping_gotos`
michael-schwarz Nov 10, 2023
de416ee
Cleanup upjumping_gotos
michael-schwarz Nov 10, 2023
e66cf56
Make type of variables used for loop termination analysis more easily…
jerhard Nov 9, 2023
e02801a
Remove redundant code for setting todo variable
jerhard Nov 10, 2023
3d3c069
Add define min_int_exp depending on the signedness of the counter var…
jerhard Nov 13, 2023
46b0f67
Change indentation in update_suite.rb back to reduce number of lines …
jerhard Nov 13, 2023
21d405d
Change indentatation back.
jerhard Nov 13, 2023
bc126fa
Fix indentation of line.
jerhard Nov 13, 2023
0e0986a
Use Z instead of Cilint
jerhard Nov 13, 2023
f18fe58
Change - to _ in name of variable introduced in terminationPreprocess…
jerhard Nov 13, 2023
aef46ce
Add LoopTermination and TerminationPreprocessing to goblint_lib
jerhard Nov 13, 2023
72c14e2
Extract function find_loop, given a loop_counter.
jerhard Nov 13, 2023
ddfcaea
Rename x to loop_counter.
jerhard Nov 13, 2023
7241324
Use increment_expression that takes the ikind of the counter variable…
jerhard Nov 13, 2023
76751d4
Termination analysis: Insert only one increment statement, do not set…
jerhard Nov 13, 2023
5d54827
Set regresion tests to todo that are now imprecise.
jerhard Nov 13, 2023
f81ca2c
Termination: Use unsigned long long for counter variables; reactivate…
jerhard Nov 13, 2023
2728c2a
Termination: Update verdict to TODO for 78/35.
jerhard Nov 14, 2023
8934a21
Autotuner: Activate termination analysis in autotuner.
jerhard Nov 14, 2023
d5662c5
Indicate that termination analysis is activated.
jerhard Nov 15, 2023
245b438
Change wording from enabling to enabled for consistency.
jerhard Nov 15, 2023
cbe4ad0
Add termination to autotune for svcomp.json, but remove it from svcom…
jerhard Nov 15, 2023
a466650
Move LoopTermination in Goblint_lib to analyses/other section.
jerhard Nov 15, 2023
b57b9e4
Extract some loops into functions; this reduces runtime of analysis.
jerhard Nov 15, 2023
70ef2d2
RelationalAnalysis: Assert type-bounds also for signed types when no-…
jerhard Nov 15, 2023
8141869
Termination distribute loops into multiple functions to make analysis…
jerhard Nov 16, 2023
1ef011c
Add test case that did not work when not asserting the type bounds fo…
jerhard Nov 16, 2023
d9f3910
Remove outdated comment.
jerhard Nov 16, 2023
26d8012
Autotuner: Remove activateTerminationAnalysis, as there is already ot…
jerhard Nov 17, 2023
28dca49
Add specification to activated settings for autotuner.
jerhard Nov 17, 2023
a4adabd
Call Autotune.focusOnSpecification before preprocessing, as terminati…
jerhard Nov 17, 2023
41ee060
Do loop unrolling for loops with boundedness check.
jerhard Nov 17, 2023
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
3 changes: 3 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ jobs:
- name: Test apron regression (Mukherjee et. al SAS '17 paper') # skipped by default but CI has apron, so explicitly test group (which ignores skipping -- it's now a feature!)
run: ruby scripts/update_suite.rb group apron-mukherjee -s

- name: Test apron termination regression # skipped by default but CI has apron, so explicitly test group (which ignores skipping -- it's now a feature!)
run: ruby scripts/update_suite.rb group termination -s

- name: Test regression cram
run: opam exec -- dune runtest tests/regression

Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/locked.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ jobs:
- name: Test apron regression (Mukherjee et. al SAS '17 paper') # skipped by default but CI has apron, so explicitly test group (which ignores skipping -- it's now a feature!)
run: ruby scripts/update_suite.rb group apron-mukherjee -s

- name: Test apron termination regression # skipped by default but CI has apron, so explicitly test group (which ignores skipping -- it's now a feature!)
run: ruby scripts/update_suite.rb group termination -s
michael-schwarz marked this conversation as resolved.
Show resolved Hide resolved

- name: Test regression cram
run: opam exec -- dune runtest tests/regression

Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/unlocked.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ jobs:
if: ${{ matrix.apron }}
run: ruby scripts/update_suite.rb group apron-mukherjee -s

- name: Test apron termination regression # skipped by default but CI has apron, so explicitly test group (which ignores skipping -- it's now a feature!)
run: ruby scripts/update_suite.rb group termination -s

- name: Test regression cram
run: opam exec -- dune runtest tests/regression

Expand Down
4 changes: 3 additions & 1 deletion conf/svcomp.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@
"octagon",
"wideningThresholds",
"loopUnrollHeuristic",
"memsafetySpecification"
"memsafetySpecification",
"termination",
"specification"
]
}
},
Expand Down
2 changes: 1 addition & 1 deletion docs/developer-guide/firstanalysis.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ The key part now is to define transfer functions for assignment. We only handle
There is no need to implement the transfer functions for branching for this example; it only relies on lattice join operations to correctly take both paths into account.

The assignment relies on the function `eval`, which is almost there. It just needs you to fix the evaluation of constants! Unless you jumped straight to this line, it should not be too complicated to fix this.
With this in place, we should have sufficient information to tell Goblint that the assertion does hold.
With this in place, we should have sufficient information to tell Goblint that the assertion does hold (run `make` to compile the updated analysis in Goblint).

For more information on the signature of the individual transfer functions, please check out `module type Spec` documentation in [`src/framework/analyses.ml`](https://github.com/goblint/analyzer/blob/master/src/framework/analyses.ml).

Expand Down
2 changes: 2 additions & 0 deletions lib/goblint/runtime/include/goblint.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ void __goblint_assume_join(/* pthread_t thread */); // undeclared argument to av

void __goblint_split_begin(int exp);
void __goblint_split_end(int exp);

void __goblint_bounded(unsigned long long exp);
4 changes: 4 additions & 0 deletions lib/goblint/runtime/src/goblint.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,8 @@ void __goblint_split_begin(int exp) {

void __goblint_split_end(int exp) {

}

void __goblint_bounded(unsigned long long exp) {

}
49 changes: 41 additions & 8 deletions scripts/update_suite.rb
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,11 @@ def collect_warnings
@vars = $1
@evals = $2
end
if l =~ /\[Termination\]/ then warnings[-1] = "nonterm" end # Get Termination warning
next unless l =~ /(.*)\(.*?\:(\d+)(?:\:\d+)?(?:-(?:\d+)(?:\:\d+)?)?\)/
obj,i = $1,$2.to_i

ranking = ["other", "warn", "race", "norace", "deadlock", "nodeadlock", "success", "fail", "unknown"]
ranking = ["other", "warn", "goto", "fundec", "loop", "term", "nonterm", "race", "norace", "deadlock", "nodeadlock", "success", "fail", "unknown"]
thiswarn = case obj
when /\(conf\. \d+\)/ then "race"
when /Deadlock/ then "deadlock"
Expand All @@ -159,6 +160,9 @@ def collect_warnings
when /invariant confirmed/ then "success"
when /invariant unconfirmed/ then "unknown"
when /invariant refuted/ then "fail"
when /(Upjumping Goto)/ then "goto"
when /(Fundec \w+ is contained in a call graph cycle)/ then "fundec"
when /(Loop analysis)/ then "loop"
when /^\[Warning\]/ then "warn"
when /^\[Error\]/ then "warn"
when /^\[Info\]/ then "warn"
Expand All @@ -183,19 +187,33 @@ def compare_warnings
if cond then
@correct += 1
# full p.path is too long and p.name does not allow click to open in terminal
if todo.include? idx then puts "Excellent: ignored check on #{relpath(p.path).to_s.cyan}:#{idx.to_s.blue} is now passing!" end
if todo.include? idx
if idx < 0
puts "Excellent: ignored check on #{relpath(p.path).to_s.cyan} for #{type.yellow} is now passing!"
else
puts "Excellent: ignored check on #{relpath(p.path).to_s.cyan}:#{idx.to_s.blue} is now passing!"
end
end
else
if todo.include? idx then @ignored += 1 else
puts "Expected #{type.yellow}, but registered #{(warnings[idx] or "nothing").yellow} on #{p.name.cyan}:#{idx.to_s.blue}"
puts tests_line[idx].rstrip.gray
ferr = idx if ferr.nil? or idx < ferr
if todo.include? idx
@ignored += 1
else
if idx < 0 # When non line specific keywords were used don't print a line
puts "Expected #{type.yellow}, but registered #{(warnings[idx] or "nothing").yellow} on #{p.name.cyan}"
else
puts "Expected #{type.yellow}, but registered #{(warnings[idx] or "nothing").yellow} on #{p.name.cyan}:#{idx.to_s.blue}"
puts tests_line[idx].rstrip.gray
ferr = idx if ferr.nil? or idx < ferr
end
end
end
}
case type
when "deadlock", "race", "fail", "unknown", "warn"
when "goto", "fundec", "loop", "deadlock", "race", "fail", "unknown", "warn"
check.call warnings[idx] == type
when "nonterm"
check.call warnings[idx] == type
when "nowarn"
when "nowarn", "term"
check.call warnings[idx].nil?
when "assert", "success"
check.call warnings[idx] == "success"
Expand Down Expand Up @@ -294,6 +312,12 @@ def parse_tests (lines)
tests[i] = "success"
elsif obj =~ /FAIL/ then
tests[i] = "fail"
elsif obj =~ /NONTERMLOOP/ then
tests[i] = "loop"
elsif obj =~ /NONTERMGOTO/ then
tests[i] = "goto"
elsif obj =~ /NONTERMFUNDEC/ then
tests[i] = "fundec"
elsif obj =~ /UNKNOWN/ then
tests[i] = "unknown"
elsif obj =~ /(assert|__goblint_check).*\(/ then
Expand All @@ -306,6 +330,15 @@ def parse_tests (lines)
end
end
end
case lines[0]
when /NONTERM/
tests[-1] = "nonterm"
when /TERM/
tests[-1] = "term"
end
if lines[0] =~ /TODO/ then
todo << -1
end
Tests.new(self, tests, tests_line, todo)
end

Expand Down
3 changes: 1 addition & 2 deletions src/analyses/apron/relationAnalysis.apron.ml
Original file line number Diff line number Diff line change
Expand Up @@ -196,15 +196,14 @@ struct
let assert_type_bounds ask rel x =
assert (RD.Tracked.varinfo_tracked x);
match Cilfacade.get_ikind x.vtype with
| ik when not (IntDomain.should_ignore_overflow ik) -> (* don't add type bounds for signed when assume_none *)
| ik ->
let (type_min, type_max) = IntDomain.Size.range ik in
(* TODO: don't go through CIL exp? *)
let e1 = BinOp (Le, Lval (Cil.var x), (Cil.kintegerCilint ik type_max), intType) in
let e2 = BinOp (Ge, Lval (Cil.var x), (Cil.kintegerCilint ik type_min), intType) in
let rel = RD.assert_inv rel e1 false (no_overflow ask e1) in (* TODO: how can be overflow when asserting type bounds? *)
let rel = RD.assert_inv rel e2 false (no_overflow ask e2) in
rel
| _
| exception Invalid_argument _ ->
rel

Expand Down
1 change: 1 addition & 0 deletions src/analyses/libraryDesc.ml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ type special =
| Identity of Cil.exp (** Identity function. Some compiler optimization annotation functions map to this. *)
| Setjmp of { env: Cil.exp; }
| Longjmp of { env: Cil.exp; value: Cil.exp; }
| Bounded of { exp: Cil.exp} (** Used to check for bounds for termination analysis. *)
| Rand
| Unknown (** Anything not belonging to other types. *) (* TODO: rename to Other? *)

Expand Down
1 change: 1 addition & 0 deletions src/analyses/libraryFunctions.ml
Original file line number Diff line number Diff line change
Expand Up @@ -718,6 +718,7 @@ let goblint_descs_list: (string * LibraryDesc.t) list = LibraryDsl.[
("__goblint_assert", special [__ "exp" []] @@ fun exp -> Assert { exp; check = true; refine = get_bool "sem.assert.refine" });
("__goblint_split_begin", unknown [drop "exp" []]);
("__goblint_split_end", unknown [drop "exp" []]);
("__goblint_bounded", special [__ "exp"[]] @@ fun exp -> Bounded { exp });
]

(** zstd functions.
Expand Down
87 changes: 87 additions & 0 deletions src/analyses/loopTermination.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
(** Termination analysis for loops and [goto] statements ([termination]). *)

open Analyses
open GoblintCil
open TerminationPreprocessing

(** Contains all loop counter variables (varinfo) and maps them to their corresponding loop statement. *)
let loop_counters : stmt VarToStmt.t ref = ref VarToStmt.empty

(** Checks whether a variable can be bounded. *)
let check_bounded ctx varinfo =
let open IntDomain.IntDomTuple in
let exp = Lval (Var varinfo, NoOffset) in
match ctx.ask (EvalInt exp) with
| `Top -> false
| `Lifted v -> not (is_top_of (ikind v) v)
jerhard marked this conversation as resolved.
Show resolved Hide resolved
| `Bot -> failwith "Loop counter variable is Bot."

(** We want to record termination information of loops and use the loop
* statements for that. We use this lifting because we need to have a
* lattice. *)
module Statements = Lattice.Flat (CilType.Stmt) (Printable.DefaultNames)

(** The termination analysis considering loops and gotos *)
module Spec : Analyses.MCPSpec =
struct

include Analyses.IdentitySpec

let name () = "termination"

module D = Lattice.Unit
module C = D
module V = struct
include UnitV
let is_write_only _ = true
end
module G = MapDomain.MapBot (Statements) (BoolDomain.MustBool)

let startstate _ = ()
let exitstate = startstate

let find_loop ~loop_counter =
VarToStmt.find loop_counter !loop_counters

(** Recognizes a call of [__goblint_bounded] to check the EvalInt of the
* respective loop counter variable at that position. *)
let special ctx (lval : lval option) (f : varinfo) (arglist : exp list) =
if !AnalysisState.postsolving then
match f.vname, arglist with
"__goblint_bounded", [Lval (Var loop_counter, NoOffset)] ->
(try
let loop_statement = find_loop ~loop_counter in
let is_bounded = check_bounded ctx loop_counter in
ctx.sideg () (G.add (`Lifted loop_statement) is_bounded (ctx.global ()));
(* In case the loop is not bounded, a warning is created. *)
if not (is_bounded) then (
M.warn ~loc:(M.Location.CilLocation (Cilfacade.get_stmtLoc loop_statement)) ~category:Termination "The program might not terminate! (Loop analysis)"
);
()
with Not_found ->
failwith "Encountered a call to __goblint_bounded with an unknown loop counter variable.")
| _ -> ()
else ()

let query ctx (type a) (q: a Queries.t): a Queries.result =
match q with
| Queries.MustTermLoop loop_statement ->
let multithreaded = ctx.ask Queries.IsEverMultiThreaded in
(not multithreaded)
&& (match G.find_opt (`Lifted loop_statement) (ctx.global ()) with
Some b -> b
| None -> false)
| Queries.MustTermAllLoops ->
let multithreaded = ctx.ask Queries.IsEverMultiThreaded in
if multithreaded then (
M.warn ~category:Termination "The program might not terminate! (Multithreaded)\n";
false)
else
G.for_all (fun _ term_info -> term_info) (ctx.global ())
| _ -> Queries.Result.top q

end

let () =
Cilfacade.register_preprocess (Spec.name ()) (new loopCounterVisitor loop_counters);
MCP.register_analysis (module Spec : MCPSpec)
Loading