This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/29350] New: pthread program compiled without -lpthread crashes.
- From: "adam dot buchbinder at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 4 Oct 2006 21:29:24 -0000
- Subject: [Bug c++/29350] New: pthread program compiled without -lpthread crashes.
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Compile:
#include <pthread.h>
// #include <iostream>
int main() {
pthread_mutexattr_t *attr;
pthread_mutexattr_init(attr);
return 0;
}
You get a link error.
Compile:
#include <pthread.h>
#include <iostream>
int main() {
pthread_mutexattr_t *attr;
pthread_mutexattr_init(attr);
return 0;
}
It compiles with no warnings (g++ -Wall testcase.cpp), but when executed,
segfaults. Compiling with -lpthread fixes it, of course, but should this be a
link-time error rather than a runtime error?
This bug was originally reported in Ubuntu's Malone bugtracker:
https://launchpad.net/distros/ubuntu/+source/gcc-4.0/+bug/26663
--
Summary: pthread program compiled without -lpthread crashes.
Product: gcc
Version: 4.0.3
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: adam dot buchbinder at gmail dot com
GCC build triplet: i486-linux-gnu
GCC host triplet: i486-linux-gnu
GCC target triplet: i486-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29350