This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: c/4372: #pragma weak pthread* inclusion causes applications to crash without a linker error when one forgets to link with -lpthread


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>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]