File tree Expand file tree Collapse file tree 4 files changed +86
-1
lines changed
tests/regression/89-apron3 Expand file tree Collapse file tree 4 files changed +86
-1
lines changed Original file line number Diff line number Diff line change 1- (* * Termination analysis for loops and [goto] statements ([termination]). *)
1+ (* * Termination analysis for loops and [goto] statements ([termination]).
2+
3+ @see <https://theses.hal.science/tel-00288805> Halbwachs, N. Détermination automatique de relations linéaires vérifiées par les variables d’un programme. PhD thesis. Section 8.3. *)
24
35open Analyses
46open GoblintCil
Original file line number Diff line number Diff line change 1+ // SKIP TERM PARAM: --set ana.activated[+] apron --set ana.apron.domain polyhedra --set ana.activated[+] termination
2+ // fully works with --set ana.widen.delay.local 6
3+ // Somehow we prove termination even without and don't have good bounds on termination counter.
4+ // From Nicolas Halbwachs' PhD thesis, section 5.6.2.
5+ #include <goblint.h>
6+
7+ int main () {
8+ unsigned int i = 0 ;
9+ unsigned int j = 0 ;
10+ while (i <= 10 ) {
11+ __goblint_check (j >= 0 );
12+ __goblint_check (i - 2 * j >= 0 );
13+ __goblint_check (i <= 10 );
14+
15+ int r ; // rand
16+ if (r ) {
17+ i += 2 ;
18+ j ++ ;
19+ }
20+ else
21+ i += 4 ;
22+ }
23+
24+ __goblint_check (j >= 0 );
25+ __goblint_check (i - 2 * j >= 0 );
26+ __goblint_check (11 <= i );
27+ __goblint_check (i <= 14 ); // TODO: needs one narrowing iteration
28+ __goblint_check (i + 2 * j <= 24 ); // TODO: needs one narrowing iteration
29+ return 0 ;
30+ }
Original file line number Diff line number Diff line change 1+ // SKIP PARAM: --set ana.activated[+] apron --set ana.apron.domain polyhedra
2+ // fully works with --set ana.widen.delay.local 6
3+ // From Nicolas Halbwachs' PhD thesis, section 8.3.
4+ // Same as 01-halbwachs-phd-sec5.6.2 annotated with an explicit termination counter.
5+ #include <goblint.h>
6+
7+ int main () {
8+ unsigned int i = 0 ;
9+ unsigned int j = 0 ;
10+ unsigned int k = 0 ; // explicit termination counter
11+ while (k ++ , i <= 10 ) {
12+ __goblint_check (j >= 0 );
13+ __goblint_check (i + 2 * j + 4 == 4 * k );
14+ __goblint_check (i <= 10 );
15+ __goblint_check (2 * k <= i + 2 );
16+
17+ int r ; // rand
18+ if (r ) {
19+ i += 2 ;
20+ j ++ ;
21+ }
22+ else
23+ i += 4 ;
24+
25+ __goblint_check (j >= 0 );
26+ __goblint_check (i + 2 * j == 4 * k );
27+ __goblint_check (i <= 14 );
28+ __goblint_check (1 <= k );
29+ __goblint_check (k <= 6 );
30+ __goblint_check (2 * k <= i );
31+ }
32+
33+ __goblint_check (j >= 0 );
34+ __goblint_check (i + 2 * j + 4 == 4 * k ); // TODO: needs one narrowing iteration?
35+ __goblint_check (11 <= i );
36+ __goblint_check (i <= 14 ); // TODO: needs one narrowing iteration?
37+ __goblint_check (2 * k <= i + 2 ); // TODO: needs one narrowing iteration?
38+
39+ // if i and j are projected out:
40+ __goblint_check (4 <= k );
41+ __goblint_check (k <= 7 ); // TODO: needs one narrowing iteration?
42+ return 0 ;
43+ }
Original file line number Diff line number Diff line change 1+ (rule
2+ (aliases runtest runaprontest)
3+ (enabled_if %{lib-available:apron})
4+ (deps
5+ (package goblint)
6+ ../../../goblint ; update_suite calls local goblint
7+ (:update_suite ../../../scripts/update_suite.rb)
8+ (glob_files ??-*.c))
9+ (locks /update_suite)
10+ (action (chdir ../../.. (run %{update_suite} group apron3 -q))))
You can’t perform that action at this time.
0 commit comments