Package: tcc
Version: 0.9.26~git20120104.83d57c0-5
Severity: normal
Hi,
When using pthread_cleanup_push() from a threaded function, tcc won't
compile. Please see the attached example file thread.c. Here is how it
compiles with gcc and tcc:
$ gcc -Wall -Wextra thread.c -pthread
thread.c: In function ‘clean_something’:
thread.c:3:28: warning: unused parameter ‘NULL_value’ [-Wunused-parameter]
$ tcc -Wall -Wextra thread.c -pthread
thread.c:10: warning: implicit declaration of function '__builtin_expect'
tcc: error: undefined symbol '__builtin_expect'
Cheers,
Matteo
-- System Information:
Debian Release: wheezy/sid
APT prefers unstable
APT policy: (900, 'unstable')
Architecture: amd64 (x86_64)
Kernel: Linux 3.2.0-2-amd64 (SMP w/2 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages tcc depends on:
ii dpkg 1.16.3
ii install-info 4.13a.dfsg.1-10
ii libc6 2.13-32
Versions of packages tcc recommends:
ii libc6-dev [libc-dev] 2.13-32
tcc suggests no packages.
-- no debconf information
#include <pthread.h>
void clean_something(void* NULL_value)
{
// some code
}
void* thread_func(void* NULL_value)
{
pthread_cleanup_push(&clean_something, NULL) ;
// some code
pthread_cleanup_pop(1) ;
pthread_exit(NULL_value) ;
}
int main(void)
{
pthread_t mythread ;
pthread_create(&mythread, NULL, &thread_func, NULL) ;
return 0 ;
}