| [f72f577] | 1 | /*****************************************************************************
|
|---|
| 2 | * SOURCE: This is a translation of a Pthread program from
|
|---|
| 3 | * the Pthread benchmarks of SV-COMP 2014.
|
|---|
| 4 | * https://svn.sosy-lab.org/software/sv-benchmarks/tags/svcomp14/
|
|---|
| 5 | * FILE: fib_bench_longer_true.cvl
|
|---|
| 6 | * DESCRIPTION:
|
|---|
| 7 | * Fix for fib_bench_longer_true program. Simply involves changing the bounds
|
|---|
| 8 | * of the assertion so the threads will interact with the global variable to
|
|---|
| 9 | * produce the desired value.
|
|---|
| 10 | * Command line execution:
|
|---|
| 11 | * civl verify -inputNUM=6 fib_bench_longer_true.cvl
|
|---|
| 12 | ******************************************************************************/
|
|---|
| 13 | #include "pthread.cvh"
|
|---|
| 14 | #include <civlc.h>
|
|---|
| 15 |
|
|---|
| 16 | int i=1, j=1;
|
|---|
| 17 |
|
|---|
| 18 | $input int NUM;
|
|---|
| 19 |
|
|---|
| 20 | void *t1(void* arg)
|
|---|
| 21 | {
|
|---|
| 22 | int k = 0;
|
|---|
| 23 |
|
|---|
| 24 | for (k = 0; k < NUM; k++)
|
|---|
| 25 | i+=j;
|
|---|
| 26 |
|
|---|
| 27 | pthread_exit(NULL, false, NULL, 0); //Different parameters
|
|---|
| 28 | }
|
|---|
| 29 |
|
|---|
| 30 | void *t2(void* arg)
|
|---|
| 31 | {
|
|---|
| 32 | int k = 0;
|
|---|
| 33 |
|
|---|
| 34 | for (k = 0; k < NUM; k++)
|
|---|
| 35 | j+=i;
|
|---|
| 36 |
|
|---|
| 37 | pthread_exit(NULL, false, NULL, 0); //Different parameters
|
|---|
| 38 | }
|
|---|
| 39 |
|
|---|
| 40 | int main(int argc, char **argv)
|
|---|
| 41 | {
|
|---|
| 42 | pthread_t id1, id2;
|
|---|
| 43 |
|
|---|
| 44 | pthread_create(&id1, NULL, t1, NULL);
|
|---|
| 45 | pthread_create(&id2, NULL, t2, NULL);
|
|---|
| 46 |
|
|---|
| 47 | pthread_join(id1, NULL); //Added pthread_join, probably error in competition code
|
|---|
| 48 | pthread_join(id2, NULL);
|
|---|
| 49 |
|
|---|
| 50 | if (i > 377 || j > 377) {
|
|---|
| 51 | $assert($false);
|
|---|
| 52 | }
|
|---|
| 53 |
|
|---|
| 54 | return 0;
|
|---|
| 55 | }
|
|---|