source: CIVL/examples/pthread/esbmc/bigshot_s_false.c@ 83af34d

1.23 2.0 main test-branch
Last change on this file since 83af34d was e3151da, checked in by Ziqing Luo <ziqing@…>, 11 years ago

re-organized example directory

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

  • Property mode set to 100644
File size: 591 bytes
Line 
1#include <stdlib.h>
2#include <pthread.h>
3#include <string.h>
4
5void __VERIFIER_assert(int expression) { if (!expression) { ERROR: goto ERROR; }; return; }
6
7char *v;
8
9void *thread1(void * arg)
10{
11 v = malloc(sizeof(char) * 8);
12}
13
14void *thread2(void *arg)
15{
16 if (v) strcpy(v, "Bigshot");
17}
18
19
20int main()
21{
22 pthread_t t1, t2;
23
24 pthread_create(&t1, 0, thread1, 0);
25 pthread_join(t1, 0);
26
27 pthread_create(&t2, 0, thread2, 0);
28 pthread_join(t2, 0);
29
30 __VERIFIER_assert(v[0] == 'B'); // <---- wrong, malloc() can fail and therefore no strcpy!
31
32 return 0;
33}
Note: See TracBrowser for help on using the repository browser.