The manual says that the type of the 2nd argument of pthread_join is void **.
Now gcc.dg/tree-prof/val-profiler-threads-1.c does this:
int retval;
for(t=0;t<NUM_THREADS;t++)
pthread_join (threads[t], (void**)&retval);
which means a potential buffer overflow on LP64 targets in addition to an
alignment issue if the target is strict-alignment, for example SPARC 64-bit.
Tested on SPARC64/Linux, applied on the mainline and 7 branch as obvious.
2017-06-28 Eric Botcazou <ebotca...@adacore.com>
* gcc.dg/tree-prof/val-profiler-threads-1.c (main): Fix 2nd argument
passed to pthread_join.
--
Eric Botcazou
Index: gcc.dg/tree-prof/val-profiler-threads-1.c
===================================================================
--- gcc.dg/tree-prof/val-profiler-threads-1.c (revision 249619)
+++ gcc.dg/tree-prof/val-profiler-threads-1.c (working copy)
@@ -35,9 +35,9 @@ int main(int argc, char *argv[])
}
}
- int retval;
+ void *retval;
for(t=0;t<NUM_THREADS;t++)
- pthread_join (threads[t], (void**)&retval);
+ pthread_join (threads[t], &retval);
return buffer[10];
}