Bug#94955: Linking with libstdc++ changes behavior of a program (which does not require libstdc++)
Ben Collins <bcollins@debian.org> writes:
> On Mon, Apr 23, 2001 at 09:37:09AM -0700, Philippe Troin wrote:
> > Ben Collins <bcollins@debian.org> writes:
> >
> > > On Sun, Apr 22, 2001 at 11:31:18PM -0700, Philippe Troin wrote:
> > > > phil@resume:~% gcc -o foo foo.cpp -lstdc++
> > >
> > > IMO, you should use:
> > >
> > > % g++ foo foo.cpp
> >
> > This brings the same result as 'gcc -o foo foo.cpp -lstdc++': crash.
> >
> > > ...instead. There are a lot more things going on when using g++ other
> > > than adding -lstdc++.
> >
> > According to 'gcc -v' the only difference between `g++ -o foo foo.cpp'
> > and `gcc -o foo foo.cpp' is the two extra libraries `-lstdc++ -lm' at
> > link time...
> >
> > > If this works for you, then I suggest closing the bug.
> >
> > If it were that easy...
> >
> > As mentionned in the initial bug report, I found this with a much
> > bigger program that was crashing when throwing complex (instances of
> > derived classes) exceptions... This program was initially compiled and
> > linked with g++. This program does not need libstdc++. When I tried to
> > link it without (with gcc), it started working.
> >
> > Just adding '-lstdc++' makes exceptions handling buggy... The crash
> > happens during the throw()... I'm quite puzzled...
>
> Interesting. It works perfectly fine for me under sparc (even with your
> command line). Of course, I am using a gcc-3.0 snapshot more recent than
> that in the archive. I'll be uploading a new snapshot within a day or
> two, so please give that a try.
The aleph package (this is the bigger c++ program that led me to
discover this) has problems with this (works linked without stdc++,
breaks with stdc++ linked in) only on arm and mips.
The much simplier test program only fails on mips, but I would suspect
it's the same underlying cause.
Phil.
Reply to: