throw-catch block causes corruption of memory over the stack
Jim Wilson
wilson@specifixinc.com
Fri May 7 23:40:00 GMT 2004
Gashtil, Kambeez wrote:
> /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
The problem is your use of -fstack-check. Your program will work if you
don't use this option.
I believe this option is intended only for specialized purposes, and
wasn't meant to be used for ordinary unix programs. This option emits
code to read past the end of the stack, to make sure that there is room
for the stack to grow. This is fine if you have a fixed size stack.
But for unix programs, the stack dynamically grows as necessary, and
accesses past the end of the stack indicates bugs. Thus the only thing
this option can do for a normal unix program is make your program fail
with a segfault.
--
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com
More information about the Gcc-bugs
mailing list