Can't use pthread_cleanup_push with non-GCC compiler
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
GLibC |
Fix Released
|
Unknown
|
|||
glibc (Ubuntu) |
Fix Released
|
Low
|
Unassigned |
Bug Description
When trying to compile a small pthread code with the Portland compiler the pthread.h gives me code that uses gcc builtins.
libc6-dev version 2.3.5-1ubuntu12
Code:
#include <pthread.h>
int
main ()
{
pthread_t th=pthread_self();
pthread_
pthread_
pthread_
pthread_
pthread_
return 0;
}
When compiled with PGI i get
$ pgcc -o ptest ptest.c -lpthread
ptest.c:
ptest.o: In function `main':
ptest.c:
This seems to be caused by the following sequence of #if defined in pthread.h
...
#if defined __GNUC__ && defined __EXCEPTIONS
# ifdef __cplusplus
...
# define pthread_
do { \
__pthread_
...
# else
# define pthread_
do { \
struct __pthread_
__attribute__ ((__cleanup__ (__pthread_
= { .__cancel_routine = (routine), .__cancel_arg = (arg), \
.__do_it = 1 };
...
# endif
#else
# define pthread_
do { \
__pthread_
void (*__cancel_routine) (void *) = (routine); \
void *__cancel_arg = (arg); \
int not_first_call = __sigsetjmp ((struct __jmp_buf_tag *) \
if (__builtin_expect (not_first_call, 0)) \
...
#endif
I.e. it uses __builtin_expect when __GCC__ is not defined.
All of this seems to be a bit too GCC centric.
Changed in glibc: | |
status: | Unknown → Unconfirmed |
Changed in glibc: | |
status: | Unconfirmed → Confirmed |
Changed in glibc: | |
status: | New → Fix Released |
Forgot to mention that this is on a x86_64 machine.