1.23
2.0
main
test-branch
| Line | |
|---|
| 1 | extern void __VERIFIER_error();
|
|---|
| 2 |
|
|---|
| 3 | #include <stdlib.h>
|
|---|
| 4 | #include <pthread.h>
|
|---|
| 5 | #include <string.h>
|
|---|
| 6 |
|
|---|
| 7 | void __VERIFIER_assert(int expression) { if (!expression) { ERROR: __VERIFIER_error();}; return; }
|
|---|
| 8 |
|
|---|
| 9 | char *v;
|
|---|
| 10 |
|
|---|
| 11 | void *thread1(void * arg)
|
|---|
| 12 | {
|
|---|
| 13 | v = malloc(sizeof(char) * 8);
|
|---|
| 14 | }
|
|---|
| 15 |
|
|---|
| 16 | void *thread2(void *arg)
|
|---|
| 17 | {
|
|---|
| 18 | if (v) strcpy(v, "Bigshot");
|
|---|
| 19 | }
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 | int main()
|
|---|
| 23 | {
|
|---|
| 24 | pthread_t t1, t2;
|
|---|
| 25 |
|
|---|
| 26 | pthread_create(&t1, 0, thread1, 0);
|
|---|
| 27 | pthread_create(&t2, 0, thread2, 0);
|
|---|
| 28 | pthread_join(t1, 0);
|
|---|
| 29 | pthread_join(t2, 0);
|
|---|
| 30 |
|
|---|
| 31 | __VERIFIER_assert(!v || v[0] == 'B');
|
|---|
| 32 |
|
|---|
| 33 | return 0;
|
|---|
| 34 | }
|
|---|
| 35 |
|
|---|
| 36 |
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.