This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

throw-catch block causes corruption of memory over the stack


Hi,

In the example, I raise an exception and catch it in the same scope.
It happens all in function TestException(). Using the debugger I watched
out, that as soon as I pass the catch(...) construct, parts of memory
allocated over the stack for local/automatic variables are corrupted. As you
see, I have used only very premitive data types, except CDummyString, which
is a very simple model of typical String class.
All used classes are there in the source code.

If the pointers get corrupted, then you get core dump, because of
Segmentation Fault.
Otherwise you have wrong values in your variables.

Here you find the output of gcc command, I use to compile and build my
example:

Reading specs from /usr/local/lib/gcc-lib/hppa2.0w-hp-hpux11.11/3.3.3/specs
Configured with: /scratch/zack/pkgbuild/3.3.1/hpux-11/gcc-3.3.3/configure
--enable-languages=c,c++ --enable-threads=posix --disable-nls --with-gnu-as
--without-gnu-ld --with-as=/usr/local/bin/as --prefix=/usr/local
Thread model: posix
gcc version 3.3.3
 /usr/local/lib/gcc-lib/hppa2.0w-hp-hpux11.11/3.3.3/cc1plus -E -D__GNUG__=3
-quiet -v -D__GNUC__=3 -D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=3
-Dnthread_hpux=1 -DHPUX_VERS=1100 -DACE_HAS_THREADS
-D_POSIX_C_SOURCE=199506L -DACE_HAS_EXCEPTIONS kam.cpp -Wall
-Wno-uninitialized -Wsynth -fno-use-cxa-atexit -fstack-check -fexceptions
kam.ii
ignoring nonexistent directory "/usr/local/hppa2.0w-hp-hpux11.11/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include/c++/3.3.3
 /usr/local/include/c++/3.3.3/hppa2.0w-hp-hpux11.11
 /usr/local/include/c++/3.3.3/backward
 /usr/local/include
 /usr/local/lib/gcc-lib/hppa2.0w-hp-hpux11.11/3.3.3/include
 /usr/include
End of search list.
 /usr/local/lib/gcc-lib/hppa2.0w-hp-hpux11.11/3.3.3/cc1plus -fpreprocessed
kam.ii -quiet -dumpbase kam.cpp -auxbase-strip kam.o -g -Wall
-Wno-uninitialized -Wsynth -version -fno-use-cxa-atexit -fstack-check
-fexceptions -o kam.s
GNU C++ version 3.3.3 (hppa2.0w-hp-hpux11.11)
        compiled by GNU C version 3.3.3.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
 /usr/local/bin/as --traditional-format -o kam.o kam.s

gcc release version:
gcc 3.3.3

How to repeat the roblem:
just build the progrma and run it.

And the kam.ii file has been attached to this e-mail .

Thanks in advance,

KG


 <<kam.ii>> 



=================================
S4M - Solutions for Media GmbH

Media Sales
Software Engineer

Am Coloneum 3  *  D - 50829 Köln
Fon     +49 (0)221 / 28 555 - 526
Fax     +49 (0)221 / 28 555 - 444

http://www.s4m.de
mailto:Kambeez.Gashtil@s4m.de 
=================================


Attachment: kam.ii
Description: Binary data


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