Skip to content

Commit 6ba8a85

Browse files
Move annotations to make tests in folder 42 compile
References #492
1 parent 194c03f commit 6ba8a85

37 files changed

+351
-154
lines changed

tests/regression/23-partitioned_arrays_last/01-simple_array.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ void example7(void) {
156156
assert(a[top] == 0); // UNKNOWN
157157
}
158158

159-
// Check that the global variable is not used for paritioning
159+
// Check that the global variable is not used for partitioning
160160
void example8() {
161161
int a[10];
162162

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
// PARAM: --enable annotation.int.enabled --set ana.int.refinement fixpoint
22
#include<assert.h>
33

4-
int f(int in) __attribute__ ((goblint_precision("def_exc", "interval"))) {
4+
int f(int in) __attribute__ ((goblint_precision("def_exc", "interval")));
5+
int main() __attribute__ ((goblint_precision("def_exc")));
6+
7+
int f(int in) {
58
in++;
69
return in;
710
}
811

9-
int main() __attribute__ ((goblint_precision("def_exc"))) {
12+
int main() {
1013
int a = 0;
1114
assert(a); // FAIL!
1215
a = f(a);
1316
assert(a);
1417
return 0;
15-
}
18+
}
Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
// PARAM: --enable annotation.int.enabled --set ana.int.refinement fixpoint
22
#include<assert.h>
33

4-
int f(int in) __attribute__ ((goblint_precision("no-def_exc","interval"))) {
4+
int f(int in) __attribute__ ((goblint_precision("no-def_exc","interval")));
5+
int main() __attribute__ ((goblint_precision("def_exc", "interval"))) ;
6+
7+
int f(int in) {
58
in++;
69
return in;
710
}
811

9-
int main() __attribute__ ((goblint_precision("def_exc", "interval"))) {
12+
int main() {
1013
int a = 0;
1114
assert(a); // FAIL!
1215
a = f(a);
1316
assert(a);
1417
return 0;
15-
}
18+
}
Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
// PARAM: --enable annotation.int.enabled --set ana.int.refinement fixpoint
22
#include<assert.h>
33

4-
int f(int in) __attribute__ ((goblint_precision("no-def_exc","interval"))) {
4+
int f(int in) __attribute__ ((goblint_precision("no-def_exc","interval")));
5+
int main() __attribute__ ((goblint_precision("no-def_exc","congruence")));
6+
7+
int f(int in) {
58
in++;
69
return in;
710
}
811

9-
int main() __attribute__ ((goblint_precision("no-def_exc","congruence"))) {
12+
int main() {
1013
int a = 0;
1114
int b = f(a);
1215
assert(b);
1316
a = b % 2;
1417
b = f(a);
1518
assert(b == 2);
1619
return 0;
17-
}
20+
}

tests/regression/42-annotated-precision/04-struct.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,15 @@ struct a {
66
int i;
77
};
88

9-
void f(struct a *in) __attribute__ ((goblint_precision("no-def_exc","interval", "congruence"))) {
9+
void f(struct a *in) __attribute__ ((goblint_precision("no-def_exc","interval", "congruence")));
10+
int main() __attribute__ ((goblint_precision("congruence")));
11+
12+
void f(struct a *in) {
1013
in->i += 4;
1114
return;
1215
}
1316

14-
int main() __attribute__ ((goblint_precision("congruence"))) {
17+
int main() {
1518
struct a a1, b1 = {"Jane", 3};
1619

1720
a1.name = "John";
@@ -24,4 +27,4 @@ int main() __attribute__ ((goblint_precision("congruence"))) {
2427
b1.i = a1.i % 5;
2528
assert(b1.i); // FAIL!
2629
return 0;
27-
}
30+
}

tests/regression/42-annotated-precision/05-array.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@
33
#include<stdbool.h>
44
#include<assert.h>
55

6-
void f(int in[], int len) __attribute__ ((goblint_precision("no-def_exc","interval", "congruence"))) {
6+
void f(int in[], int len) __attribute__ ((goblint_precision("no-def_exc","interval", "congruence")));
7+
void g(bool in[], int len) __attribute__ ((goblint_precision("interval", "enums", "congruence")));
8+
int main() __attribute__ ((goblint_precision("interval")));
9+
10+
11+
void f(int in[], int len) {
712
assert(in[0]); // FAIL!
813
int c[len];
914
for (int i = 0; i < len; i++) {
@@ -13,14 +18,14 @@ void f(int in[], int len) __attribute__ ((goblint_precision("no-def_exc","interv
1318
return;
1419
}
1520

16-
void g(bool in[], int len) __attribute__ ((goblint_precision("interval", "enums", "congruence"))) {
21+
void g(bool in[], int len) {
1722
for (int i = 0; i < len; i++) {
1823
in[i] ^= true;
1924
}
2025
return;
2126
}
2227

23-
int main() __attribute__ ((goblint_precision("interval"))) {
28+
int main() {
2429
int a[] = {0,0,0};
2530
bool b[] = {true, false};
2631
char s[][] = {"Edward","Tom","Julia"};
@@ -34,4 +39,4 @@ int main() __attribute__ ((goblint_precision("interval"))) {
3439
a[1] = 1;
3540
assert(a[1]); // UNKNOWN!
3641
return 0;
37-
}
42+
}
Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,24 @@
11
// PARAM: --enable annotation.int.enabled --enable exp.earlyglobs --set ana.int.refinement fixpoint
22
#include<assert.h>
33

4+
int inc(int in) __attribute__ ((goblint_precision("no-def_exc", "interval")));
5+
int main() __attribute__ ((goblint_precision("def_exc")));
6+
47
int g1 = 0;
58
int g2 = 0;
69

7-
int inc(int in) __attribute__ ((goblint_precision("no-def_exc", "interval"))) {
10+
int inc(int in) {
811
int b = in + 1;
912
assert(b);
1013
g2 = 1;
1114
return b;
1215
}
1316

14-
int main() __attribute__ ((goblint_precision("def_exc"))) {
17+
int main() {
1518
int a = 0;
1619
assert(g1); // FAIL!
1720
a = inc(g1);
1821
assert(a == g1); // FAIL!
1922
assert(a == g2); // UNKNOWN!
2023
return 0;
21-
}
24+
}
Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
// PARAM: --enable annotation.int.enabled --set ana.int.refinement fixpoint
22

3-
int f(int in) __attribute__((goblint_precision("def_exc"))) {
3+
int f(int in) __attribute__((goblint_precision("def_exc")));
4+
int main() __attribute__((goblint_precision("no-def_exc")));
5+
6+
7+
int f(int in) {
48
return in + 1;
59
}
610

7-
int main() __attribute__((goblint_precision("no-def_exc"))) {
11+
int main() {
812
int a = 1;
913
assert(a); // UNKNOWN!
1014
a = f(a);
1115
return 0;
12-
}
16+
}

tests/regression/42-annotated-precision/08-22_01-simple_array.c

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,20 @@
11
// PARAM: --set solver td3 --enable ana.int.interval --enable exp.partition-arrays.enabled --set ana.activated "['base','threadid','threadflag','escape','expRelation','mallocWrapper']" --set exp.privatization none --enable annotation.int.enabled --set ana.int.refinement fixpoint
22
int global;
33

4-
int main(void) __attribute__((goblint_precision("no-interval")))
4+
int main(void) __attribute__((goblint_precision("no-interval")));
5+
void example1(void) __attribute__((goblint_precision("no-def_exc")));
6+
void example2(void) __attribute__((goblint_precision("no-def_exc")));
7+
void example3(void) __attribute__((goblint_precision("no-def_exc")));
8+
void example4(void) __attribute__((goblint_precision("no-def_exc")));
9+
void example5(void) __attribute__((goblint_precision("no-def_exc")));
10+
void example6(void) __attribute__((goblint_precision("no-def_exc")));
11+
void example7(void) __attribute__((goblint_precision("no-def_exc")));
12+
void example8() __attribute__((goblint_precision("no-def_exc")));
13+
void example9() __attribute__((goblint_precision("no-def_exc")));
14+
void example10() __attribute__((goblint_precision("no-def_exc")));
15+
16+
17+
int main(void)
518
{
619
example1();
720
example2();
@@ -17,7 +30,7 @@ int main(void) __attribute__((goblint_precision("no-interval")))
1730
}
1831

1932
// Simple example
20-
void example1(void) __attribute__((goblint_precision("no-def_exc")))
33+
void example1(void)
2134
{
2235
int a[42];
2336
int i = 0;
@@ -37,7 +50,7 @@ void example1(void) __attribute__((goblint_precision("no-def_exc")))
3750
}
3851

3952
// More complicated expression to index rather than just a variable
40-
void example2(void) __attribute__((goblint_precision("no-def_exc"))) {
53+
void example2(void) {
4154
int a[42];
4255
int i = 1;
4356

@@ -54,7 +67,7 @@ void example2(void) __attribute__((goblint_precision("no-def_exc"))) {
5467
}
5568

5669
// Two values initialized in one loop
57-
void example3(void) __attribute__((goblint_precision("no-def_exc"))) {
70+
void example3(void) {
5871
int a[42];
5972
int i = 0;
6073

@@ -72,7 +85,7 @@ void example3(void) __attribute__((goblint_precision("no-def_exc"))) {
7285
}
7386

7487
// Example where initialization proceeds backwards
75-
void example4(void) __attribute__((goblint_precision("no-def_exc"))) {
88+
void example4(void) {
7689
int a[42];
7790
int i = 41;
7891

@@ -88,7 +101,7 @@ void example4(void) __attribute__((goblint_precision("no-def_exc"))) {
88101
}
89102

90103
// Example having two arrays partitioned according to one expression
91-
void example5(void) __attribute__((goblint_precision("no-def_exc"))) {
104+
void example5(void) {
92105
int a[42];
93106
int b[42];
94107
int i = 0;
@@ -109,7 +122,7 @@ void example5(void) __attribute__((goblint_precision("no-def_exc"))) {
109122
}
110123

111124
// Example showing array becoming partitioned according to different expressions
112-
void example6(void) __attribute__((goblint_precision("no-def_exc"))) {
125+
void example6(void) {
113126
int a[42];
114127
int i = 0;
115128
int j = 0;
@@ -139,7 +152,7 @@ void example6(void) __attribute__((goblint_precision("no-def_exc"))) {
139152
}
140153

141154
// This was the case where we thought we needed path-splitting
142-
void example7(void) __attribute__((goblint_precision("no-def_exc"))) {
155+
void example7(void) {
143156
int a[42];
144157
int i = 0;
145158
int top;
@@ -159,7 +172,7 @@ void example7(void) __attribute__((goblint_precision("no-def_exc"))) {
159172
}
160173

161174
// Check that the global variable is not used for partitioning
162-
void example8() __attribute__((goblint_precision("no-def_exc"))) {
175+
void example8() {
163176
int a[10];
164177

165178
a[global] = 4;
@@ -177,7 +190,7 @@ void example8() __attribute__((goblint_precision("no-def_exc"))) {
177190
}
178191

179192
// Check that arrays of types different from int are handeled correctly
180-
void example9() __attribute__((goblint_precision("no-def_exc"))) {
193+
void example9() {
181194
char a[10];
182195
int n;
183196
assert(a[3] == 800); // FAIL
@@ -196,7 +209,7 @@ void example9() __attribute__((goblint_precision("no-def_exc"))) {
196209
assert(a[3] == -129); //FAIL
197210
}
198211

199-
void example10() __attribute__((goblint_precision("no-def_exc"))) {
212+
void example10() {
200213
int a[20];
201214
a[5] = 3;
202215

0 commit comments

Comments
 (0)