Fix dangerous casts in tests.
Fix dangerous casts of int variables to pointers in thread join function calls. On LP64 systems, int and pointers are different sizes, so writes can corrupt memory.
This commit is contained in:
parent
dda90f59e2
commit
8edaf86b67
@ -104,12 +104,12 @@ main(void)
|
|||||||
je_thread_start(NULL);
|
je_thread_start(NULL);
|
||||||
|
|
||||||
je_thread_create(&thread, je_thread_start, NULL);
|
je_thread_create(&thread, je_thread_start, NULL);
|
||||||
je_thread_join(thread, (void *)&ret);
|
je_thread_join(thread, NULL);
|
||||||
|
|
||||||
je_thread_start(NULL);
|
je_thread_start(NULL);
|
||||||
|
|
||||||
je_thread_create(&thread, je_thread_start, NULL);
|
je_thread_create(&thread, je_thread_start, NULL);
|
||||||
je_thread_join(thread, (void *)&ret);
|
je_thread_join(thread, NULL);
|
||||||
|
|
||||||
je_thread_start(NULL);
|
je_thread_start(NULL);
|
||||||
|
|
||||||
|
@ -72,8 +72,12 @@ main(void)
|
|||||||
(void *)&arena_ind);
|
(void *)&arena_ind);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < NTHREADS; i++)
|
for (i = 0; i < NTHREADS; i++) {
|
||||||
je_thread_join(threads[i], (void *)&ret);
|
intptr_t join_ret;
|
||||||
|
je_thread_join(threads[i], (void *)&join_ret);
|
||||||
|
if (join_ret != 0)
|
||||||
|
ret = 1;
|
||||||
|
}
|
||||||
|
|
||||||
label_return:
|
label_return:
|
||||||
malloc_printf("Test end\n");
|
malloc_printf("Test end\n");
|
||||||
|
@ -77,12 +77,12 @@ main(void)
|
|||||||
je_thread_start(NULL);
|
je_thread_start(NULL);
|
||||||
|
|
||||||
je_thread_create(&thread, je_thread_start, NULL);
|
je_thread_create(&thread, je_thread_start, NULL);
|
||||||
je_thread_join(thread, (void *)&ret);
|
je_thread_join(thread, NULL);
|
||||||
|
|
||||||
je_thread_start(NULL);
|
je_thread_start(NULL);
|
||||||
|
|
||||||
je_thread_create(&thread, je_thread_start, NULL);
|
je_thread_create(&thread, je_thread_start, NULL);
|
||||||
je_thread_join(thread, (void *)&ret);
|
je_thread_join(thread, NULL);
|
||||||
|
|
||||||
je_thread_start(NULL);
|
je_thread_start(NULL);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user