Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com Reply-To: From: "Kris Thielemans" To: "Gnuwin" Subject: problem with dynamic_cast Date: Thu, 31 Aug 2000 15:57:58 +0100 Message-ID: <005b01c0135b$da066de0$460a10ac@petnt1.rpms.ac.uk> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook 8.5, Build 4.71.2377.0 Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2120.0 Hi, I have a problem with some of our own C++ software when compiled with gcc on cygwin cygwin v.1.1.4 on Windows NT4.00.1381 (Finnish language). Note that this program runs fine on my own NT 4.0 sp5 or sp6 machines running cygwin B20.1 with gcc 2.95.2, and on Solaris with gcc 2.95.2, and on AIX with gcc 2.8.1). The problem occurs when executing a dynamic_cast on a pointer. Any suggestions ? details: --------- The program generates the following error: 0 [main] test_VoxelsOnCartesianGrid 1039 handle_exceptions: Exception: STATUS_ACCESS_VIOLATION 974 [main] test_VoxelsOnCartesianGrid 1039 stackdump: Dumping stack trace to test_VoxelsOnCartesianGrid.exe.stackdump make: *** [run_tests] Segmentation fault (core dumped) The file where it crashes is compiled as follows: g++ -g -D_DEBUG -g -Wall -I/home/PPhead/include -o debug/VoxelsOnCartesianGrid.o -c VoxelsOnCartesianGrid.cxx When running the program in gdb, the stack trace after the crash is: Program received signal SIGSEGV, Segmentation fault. 0x611e4 in ?? () (gdb) info stack #0 0x611e4 in ?? () #1 0x41e484 in __si_type_info::dcast (this=0x460520, to=@0x4604c0, require_public=1, addr=0xa057e90, sub=0x460280, subptr=0xa057e90) at /cygnus/netrel/src/gcc-2.95.2-2/gcc/cp/tinfo.cc:76 #2 0x41e6d3 in __dynamic_cast ( from=0x441658 , to=0x4415a4 , require_public=1, address=0xa057e90, sub=0x441544 , subptr=0xa057e90) at /cygnus/netrel/src/gcc-2.95.2-2/gcc/cp/tinfo2.cc:38 #3 0x40ddda in Tomo::find_sampling_and_z_size (z_sampling=@0x266f898, s_sampling=@0x266f894, z_size=@0x266f89c, proj_data_info_ptr=0xa057e90) at VoxelsOnCartesianGrid.cxx:45 #4 0x4325e8 in Tomo::VoxelsOnCartesianGrid::VoxelsOnCartesianGrid ( this=0x266fc00, proj_data_info=@0xa057e90, zoom=2.29999995, origin=@0x266fd10, make_xy_size_odd=false) at VoxelsOnCartesianGrid.cxx:138 #5 0x4022a6 in Tomo::VoxelsOnCartesianGridTests::run_tests (this=0x266fd60) at test_VoxelsOnCartesianGrid.cxx:103 #6 0x403174 in main () at test_VoxelsOnCartesianGrid.cxx:180 #7 0x61002272 in _size_of_stack_reserve__ () #8 0x61002805 in _size_of_stack_reserve__ () #9 0x61002843 in _size_of_stack_reserve__ () #10 0x41cdd5 in cygwin_crt0 () This seems to say there is something wrong in the dynamic_cast statement on that line, which looks as follows: if (const ProjDataInfoCylindrical* proj_data_info_cyl_ptr = dynamic_cast(proj_data_info_ptr)) { ...} By the way, if you check the stack trace, you'll see that the dynamic cast is from a ProjDataInfoCylindricalArcCorr * to a ProjDataInfoCylindrical *, where ProjDataInfoCylindricalArcCorr is derived from ProjDataInfoCylindrical. (Not that it should crash in any case). Thanks ! Kris Thielemans (kris DOT thielemans AT ic DOT ac DOT uk) MRC Cyclotron Unit, Hammersmith Hospital, DuCane Rd,London W12 0NN, United Kingdom Phone on : +44 (020)8383 3731 FAX on : +44 (020)8383 2029 NEW web site address: http://www.cu.mrc.ac.uk/~kris -- Want to unsubscribe from this list? Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com