-lpthread -lstdc++ crashes on IRIX 6.5

Peter O'Gorman pogma@thewrittenword.com
Tue Feb 22 01:06:00 GMT 2011


On Tue, Feb 22, 2011 at 12:34:44AM +0000, Jonathan Wakely wrote:
> On 21 February 2011 18:10, Peter O'Gorman wrote:
> > % echo 'int main() {}' >a.cpp
> > % g++ a.cpp -lpthread; ./a.out; echo $?
> > zsh: segmentation fault (core dumped)  ./a.out
> > 139
> >
> > We're looking at reordering -lpthread to come after -lstdc++ by patching
> > cp/g++spec.c to fix this, but perhaps that is the wrong approach?
> 
> What if you use -D_REENTRANT as well as -lpthread?

It still crashes, but I understand why you asked - the above is a
compile and link. Here's the same thing with only a link step:

% g++ -pthread -c a.cpp
% g++ -pthread a.o -o a.out
% ./a.out
% g++ -D_REENTRANT -lpthread a.o -o a.out
% ./a.out
zsh: segmentation fault (core dumped)  ./a.out
% g++ -lstdc++ -lpthread a.o -o a.out
% ./a.out
% echo $?
0

We're rebuilding now with a modified g++spec.c (patched to reorder
-lpthread after -lstdc++), but still not sure that is the correct fix
for this.

Thank you,
Peter
-- 
Peter O'Gorman
pogma@thewrittenword.com



More information about the Gcc-help mailing list