Skip to content

Commit 4ae786f

Browse files
added regtest
1 parent 319ac60 commit 4ae786f

3 files changed

Lines changed: 32 additions & 3 deletions

File tree

src/analyses/apron/apronAnalysis.apron.ml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ let spec_module: (module MCPSpec) Lazy.t =
1515
let name () = "apron"
1616
end
1717
in
18-
let narrowing_gas = GobConfig.get_int "ana.apron.narrowing_gas" in
18+
let narrowing_gas = GobConfig.get_int "ana.apron.narrowing_gas"
19+
in
1920
if (narrowing_gas > 0) then
2021
let module Narrowed =
2122
struct
@@ -27,7 +28,7 @@ let spec_module: (module MCPSpec) Lazy.t =
2728
include NarrowingGas.DLifter (Spec) (PolyhedraChainParams)
2829
module A = Spec.A
2930
let access = Spec.access
30-
let name () = "apron"
31+
let name = Spec.name
3132
end
3233
in
3334
(module Narrowed)

src/lifters/narrowingGas.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ struct
4040
let widen (b1, i1) (b2, i2) = (Base.widen b1 b2, max i1 i2)
4141
let narrow (b1, i1) (b2, i2) =
4242
let i' = max i1 i2 in
43-
if i' <= ChainParams.n () then
43+
if i' < ChainParams.n () then
4444
(Base.meet b1 b2, i' + 1) (* Stop narrowing when counter exceeds limit. *)
4545
else
4646
(Base.narrow b1 b2, i')
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// SKIP TODO TERM PARAM: --set ana.apron.narrowing_gas 1 --set ana.activated[+] apron --set ana.apron.domain polyhedra
2+
// Apron is not precise enough for some nested loops
3+
#include <goblint.h>
4+
#include <stdio.h>
5+
6+
int loops0(){
7+
int i, j, k;
8+
int a = 0;
9+
for (i = 500; i >= 1; i--)
10+
{
11+
a++;
12+
__goblint_check(a + i - 501 == 0); // needs 1x narrowing or octagons
13+
int b = 0;
14+
for (j = i; j >= 1; j--)
15+
{
16+
__goblint_check(a + b + j == 501); // needs 1x narrowing, octagons insufficient
17+
b++;
18+
}
19+
}
20+
return 0;
21+
}
22+
23+
int main()
24+
{
25+
loops0();
26+
27+
return 0;
28+
}

0 commit comments

Comments
 (0)