This is the mail archive of the cygwin@sources.redhat.com mailing list for the Cygwin project.


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

RE: problem with dynamic_cast


Hi Kris,

I didn't look at your example, but I think you shouldn't use -lm (and -lc).
libm.a/libc.a are symlinked to libcygwin.a and this is linked against every
program by default. I ran into troubles and stackdumps too, when linking
with -lm. I think there's more about this problem in the archives.

Karsten

> -----Original Message-----
> From: Kris Thielemans [mailto:kris.thielemans@ic.ac.uk]
> Sent: Freitag, 8. September 2000 12:46
> To: Gnuwin
> Cc: gcc-bugs@gcc.gnu.org
> Subject: RE: problem with dynamic_cast
> 
> 
> 
> 
> > -----Original Message-----
> > From: Chris Faylor [mailto:cgf@cygnus.com]
> > Sent: 07 September 2000 17:01
> > To: Gnuwin
> > Cc: kris.thielemans@csc.mrc.ac.uk
> > Subject: Re: problem with dynamic_cast
> >
> >
> > This is a c++ problem.  You should probably report this to a c++
> > mailing list.
> 
> I doubt it really, but I send this to a C++ mailing list 
> anyway. I've been
> able to boil it down to something really simple. If the latest gcc
> distribution is that broken, we're all in trouble.
> 
> Summarising: in cygwin 1.1.4, or the gcc (or ld) distributed 
> with it (I've
> installed 1.1.4 yesterday), there is a conflict with using 
> RTTI and using
> the math library.
> 
> 
> Attached is a VERY simple C++ program that uses RTTI, but 
> nothing else.
> Compile it with
> 
> g++ dynamic_cast.cxx -lm
> 
> When you run it, it crashes in the dynamic_cast statement. On 
> the other
> hand, compile it with
> 
> g++ dynamic_cast.cxx
> 
> -> it runs fine (i.e. does essentially nothing).
> 
> 
> 
> 
> More details:
> 
> I'm running NT 4.0 sp5 and cygwin 1.1.4.
> 
> screendump of running g++ -v:
> 
> $ g++ dynamic_cast.cxx -lm -v
> Reading specs from /usr/lib/gcc-lib/i686-pc-cygwin/2.95.2/specs
> gcc version 2.95.2 19991024 (release-2)
> 
> /usr/lib/gcc-lib/i686-pc-cygwin/2.95.2/cpp.exe -lang-c++ -v 
> -D__GNUC__=2 -D_
> _GN
> UG__=2 -D__GNUC_MINOR__=95 -D__cplusplus -Di386 -D_X86=1 
> -D__STDC__=1 -D__st
> dcal
> l=__attribute__((__stdcall__)) 
> -D__cdecl=__attribute__((__cdecl__)) -D__decl
> spec
> (x)=__attribute__((x)) -D__i386__ -D_X86=1 -D__STDC__=1 
> -D__stdcall=__attrib
> ute_
> _((__stdcall__)) -D__cdecl=__attribute__((__cdecl__)) 
> -D__declspec(x)=__attr
> ibut
> e__((x)) -D__i386 -Asystem(winnt) -Acpu(i386) -Amachine(i386) 
> -D__EXCEPTIONS
>  -re
> map -Acpu(i386) -Amachine(i386) -Di386 -D__i386 -D__i386__ 
> -Di686 -Dpentiump
> ro -
> D__i686 -D__i686__ -D__pentiumpro -D__pentiumpro__ 
> -D__CYGWIN32__ -D__CYGWIN
> __ -
> Dunix -D_WIN32 -DWINNT dynamic_cast.cxx /cygdrive/c/TMP/ccpF3zVU.ii
> GNU CPP version 2.95.2 19991024 (release-2) (80386, BSD syntax)
> #include "..." search starts here:
> #include <...> search starts here:
>  /usr/include
>  /usr/lib/gcc-lib/i686-pc-cygwin/2.95.2/../../../../include/g++-3
>  /usr/lib/gcc-lib/i686-pc-cygwin/2.95.2/../../../../include
>  /usr/include
>  /usr/lib/gcc-lib/i686-pc-cygwin/2.95.2/include
>  /usr/include
> End of search list.
> The following default directories have been omitted from the 
> search path:
>  /usr/include/g++
>  /usr/X11R6.4/include
>  /usr/local/include
> End of omitted list.
>  /usr/lib/gcc-lib/i686-pc-cygwin/2.95.2/cc1plus.exe
> /cygdrive/c/TMP/ccpF3zVU.ii
> -quiet -dumpbase dynamic_cast.cc -version -o 
> /cygdrive/c/TMP/ccKbIuaN.s
> GNU C++ version 2.95.2 19991024 (release-2) (i686-pc-cygwin) 
> compiled by GNU
> C v
> ersion 2.95.2 19991024 (release-2).
>  as -o /cygdrive/c/TMP/cc7g2nmV.o /cygdrive/c/TMP/ccKbIuaN.s
>  /usr/lib/gcc-lib/i686-pc-cygwin/2.95.2/collect2.exe -Bdynamic
> /usr/lib/crt0.o -
> L/usr/lib/gcc-lib/i686-pc-cygwin/2.95.2
> /cygdrive/c/TMP/cc7g2nmV.o -lstdc++ -lm
> -lgcc -lcygwin -luser32 -lkernel32 -ladvapi32 -lshell32 -lgcc
> 
> ld.dump attached is a screendump from running ld --verbose 
> explicitly, after
> removing as much libraries and options I could, while still 
> reproducing the
> crash.
> 
> 
> gdb.dump is a screendump from running gdb on the file
> 

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com


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