source: CIVL/examples/translation/pthread/fib_bench_longer_false.cvl@ 63d4ef2

1.23 2.0 main test-branch
Last change on this file since 63d4ef2 was 8d512ae, checked in by John Edenhofner <johneden@…>, 12 years ago

Changed location of pthread.cvh, and updated files to use pthread.h (which includes pthread.cvh). New translations from pthread-atomic, and updated pthread.cvh

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@1092 fb995dde-84ed-4084-dfe6-e5aef3e2452c

  • Property mode set to 100644
File size: 1.4 KB
Line 
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_false.cvl
6* DESCRIPTION:
7* Simple program of threads interacting which causes an error when
8* their total reaches a certain value. The fix simply involves changing the output
9* for which an error will be caused; specifically, here error is caused when i or j
10* >=377, the fix has i or j > 377.
11* Command line execution:
12* civl verify -inputNUM=6 fib_bench_longer_false.cvl
13******************************************************************************/
14#include "pthread.h"
15#include <civlc.h>
16
17int i=1, j=1;
18
19$input int NUM;
20
21void *t1(void* arg)
22{
23 int k = 0;
24
25 for (k = 0; k < NUM; k++)
26 i+=j;
27
28 pthread_exit(NULL, false, NULL, 0); //Different parameters
29}
30
31void *t2(void* arg)
32{
33 int k = 0;
34
35 for (k = 0; k < NUM; k++)
36 j+=i;
37
38 pthread_exit(NULL, false, NULL, 0); //Different parameters
39}
40
41int main(int argc, char **argv)
42{
43 pthread_t id1, id2;
44
45 pthread_create(&id1, NULL, t1, NULL);
46 pthread_create(&id2, NULL, t2, NULL);
47
48 pthread_join(id1, NULL); //Added pthread_join, probably error in competition code
49 pthread_join(id2, NULL);
50
51 if (i >= 377 || j >= 377) {
52 $assert($false);
53 }
54 return 0;
55}
Note: See TracBrowser for help on using the repository browser.