add MC2_function call for assignments where RHS computed from loads; tweak tests
[satcheck.git] / clang / test / fib_easy_true.c
1 /* Adapted from: https://svn.sosy-lab.org/software/sv-benchmarks/trunk/c/pthread/fib_bench_true-unreach-call.c */
2
3 #include <assert.h>
4 #include <stdbool.h>
5 #include <threads.h>
6 #include "libinterface.h"
7
8 /* volatile */ int i, j;
9
10 #define NULL 0
11
12 void t1(void* arg) {
13
14   int t1, t2, sum;
15
16   t1 = load_32(&i);
17   t2 = load_32(&j);
18   sum = t1 + t2;
19   store_32(&i, sum);
20
21   t1 = load_32(&i);
22   if (t1 > 3) {
23     assert(0);
24   }
25 }
26
27 void t2(void* arg) {
28
29   int tt1, tt2, sum;
30
31   tt1 = load_32(&j);
32   tt2 = load_32(&i);
33   sum = tt1 + tt2;
34   store_32(&j, sum);
35
36   tt1 = load_32(&j);
37   if (tt1 > 3) {
38     assert(0);
39   }
40 }
41
42 int user_main(int argc, char **argv)
43 {
44   thrd_t a, b;
45
46   store_32(&i, 1);
47   store_32(&j, 1);
48
49   thrd_create(&a, t1, NULL);
50   thrd_create(&b, t2, NULL);
51
52   thrd_join(a);
53   thrd_join(b);
54
55   return 0;
56 }