This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: c/4372: #pragma weak pthread* inclusion causes applications to crash without a linker error when one forgets to link with -lpthread
- From: Carlo Wood <carlo at alinoe dot com>
- To: bangerth at dealii dot org, gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, nobody at gcc dot gnu dot org, gcc-gnats at gcc dot gnu dot org
- Date: Wed, 15 Jan 2003 01:23:32 +0100
- Subject: Re: c/4372: #pragma weak pthread* inclusion causes applications to crash without a linker error when one forgets to link with -lpthread
- References: <20030114231022.29346.qmail@sources.redhat.com>
On Tue, Jan 14, 2003 at 11:10:22PM -0000, bangerth@dealii.org wrote:
> Synopsis: #pragma weak pthread* inclusion causes applications to crash without a linker error when one forgets to link with -lpthread
>
> State-Changed-From-To: feedback->closed
> State-Changed-By: bangerth
> State-Changed-When: Tue Jan 14 15:10:22 2003
> State-Changed-Why:
> No feedback (at least not in audit trail)
>
> http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=4372
Well, open it again because yes - this problem still exists with 3.2.1.
>g++ test.cc -o test
>./test
Segmentation fault
and
>g++ test.cc -o test -lpthread
>./test
>
I don't understand why you needed to feedback though.
The small test case is simple enough, no?
Still,
>cat test.cc
#include <iosfwd>
#include <pthread.h>
static pthread_once_t S_key_once;
static pthread_key_t S_key;
void S_destroy(void* tsd_ptr) throw()
{
}
void S_alloc_key(void) throw()
{
pthread_key_create(&S_key, S_destroy);
}
int main(void)
{
pthread_once(&S_key_once, S_alloc_key);
}
--
Carlo Wood <carlo@alinoe.com>