[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#373555: marked as done (Can't use pthread_cleanup_push with non-GCC compiler)



Your message dated Sun, 26 Nov 2017 23:46:02 +0100
with message-id <20171126224602.irhdjgyqx7ffym7k@aurel32.net>
and subject line Bug#373555: Can't use pthread_cleanup_push with non-GCC compiler
has caused the Debian Bug report #373555,
regarding Can't use pthread_cleanup_push with non-GCC compiler
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
373555: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=373555
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: libc6-dev
Version: 2.3.6-15

When trying to compile a small pthread code with the Portland compiler
the pthread.h gives me code that uses gcc builtins.

System is a x86_64 machine with nptl based pthread.

Code:
#include <pthread.h>
int
main ()
{
    pthread_t th=pthread_self();
    pthread_join(th, 0);
    pthread_attr_init(0);
    pthread_cleanup_push(0, 0);
    pthread_create(0,0,0,0);
    pthread_cleanup_pop(0);
    return 0;
}

When compiled with PGI i get
$ pgcc -o ptest ptest.c -lpthread
ptest.c:
ptest.o: In function `main':
ptest.c:(.text+0x46): undefined reference to `__builtin_expect'

This seems to be caused by the following sequence of #if defined in
pthread.h

...
#if defined __GNUC__ && defined __EXCEPTIONS
# ifdef __cplusplus
...
# define pthread_cleanup_push(routine, arg) \
  do { \
    __pthread_cleanup_class __clframe (routine, arg)
...
# else
# define pthread_cleanup_push(routine, arg) \
   do { \
    struct __pthread_cleanup_frame __clframe \
      __attribute__ ((__cleanup__ (__pthread_cleanup_routine))) \
      = { .__cancel_routine = (routine), .__cancel_arg = (arg), \
          .__do_it = 1 };
...
# endif
#else
# define pthread_cleanup_push(routine, arg) \
  do { \
    __pthread_unwind_buf_t __cancel_buf; \
    void (*__cancel_routine) (void *) = (routine); \
    void *__cancel_arg = (arg); \
    int not_first_call = __sigsetjmp ((struct __jmp_buf_tag *) \
                                      __cancel_buf.__cancel_jmp_buf, 0);
\
    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.



--- End Message ---
--- Begin Message ---
Version: 2.16-0experimental0

On 2006-06-14 11:06, Åke Sandgren wrote:
> Package: libc6-dev
> Version: 2.3.6-15
> 
> When trying to compile a small pthread code with the Portland compiler
> the pthread.h gives me code that uses gcc builtins.
> 
> System is a x86_64 machine with nptl based pthread.
> 
> Code:
> #include <pthread.h>
> int
> main ()
> {
>     pthread_t th=pthread_self();
>     pthread_join(th, 0);
>     pthread_attr_init(0);
>     pthread_cleanup_push(0, 0);
>     pthread_create(0,0,0,0);
>     pthread_cleanup_pop(0);
>     return 0;
> }
> 
> When compiled with PGI i get
> $ pgcc -o ptest ptest.c -lpthread
> ptest.c:
> ptest.o: In function `main':
> ptest.c:(.text+0x46): undefined reference to `__builtin_expect'
> 
> This seems to be caused by the following sequence of #if defined in
> pthread.h
> 
> ...
> #if defined __GNUC__ && defined __EXCEPTIONS
> # ifdef __cplusplus
> ...
> # define pthread_cleanup_push(routine, arg) \
>   do { \
>     __pthread_cleanup_class __clframe (routine, arg)
> ...
> # else
> # define pthread_cleanup_push(routine, arg) \
>    do { \
>     struct __pthread_cleanup_frame __clframe \
>       __attribute__ ((__cleanup__ (__pthread_cleanup_routine))) \
>       = { .__cancel_routine = (routine), .__cancel_arg = (arg), \
>           .__do_it = 1 };
> ...
> # endif
> #else
> # define pthread_cleanup_push(routine, arg) \
>   do { \
>     __pthread_unwind_buf_t __cancel_buf; \
>     void (*__cancel_routine) (void *) = (routine); \
>     void *__cancel_arg = (arg); \
>     int not_first_call = __sigsetjmp ((struct __jmp_buf_tag *) \
>                                       __cancel_buf.__cancel_jmp_buf, 0);
> \
>     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.
> 

This bug has been fixed in upstream glibc 2.16, which first appeared in
debian as eglibc 2.16-0experimental0. Closing the bug.

-- 
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
aurelien@aurel32.net                 http://www.aurel32.net

--- End Message ---

Reply to: