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]

Re: throw-catch block causes corruption of memory over the stack


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



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