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:
@@ -104,12 +104,12 @@ main(void)
|
||||
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_create(&thread, je_thread_start, NULL);
|
||||
je_thread_join(thread, (void *)&ret);
|
||||
je_thread_join(thread, NULL);
|
||||
|
||||
je_thread_start(NULL);
|
||||
|
||||
|
@@ -72,8 +72,12 @@ main(void)
|
||||
(void *)&arena_ind);
|
||||
}
|
||||
|
||||
for (i = 0; i < NTHREADS; i++)
|
||||
je_thread_join(threads[i], (void *)&ret);
|
||||
for (i = 0; i < NTHREADS; i++) {
|
||||
intptr_t join_ret;
|
||||
je_thread_join(threads[i], (void *)&join_ret);
|
||||
if (join_ret != 0)
|
||||
ret = 1;
|
||||
}
|
||||
|
||||
label_return:
|
||||
malloc_printf("Test end\n");
|
||||
|
@@ -77,12 +77,12 @@ main(void)
|
||||
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_create(&thread, je_thread_start, NULL);
|
||||
je_thread_join(thread, (void *)&ret);
|
||||
je_thread_join(thread, NULL);
|
||||
|
||||
je_thread_start(NULL);
|
||||
|
||||
|
Reference in New Issue
Block a user