This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: Is it a bug of gcc
- From: Jim Wilson <wilson at specifixinc dot com>
- To: dong jin <zdjchina at hotmail dot com>
- Cc: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 06 Jan 2004 11:24:52 -0800
- Subject: Re: Is it a bug of gcc
- References: <BAY13-F64rbKFnfM41N0004751a@hotmail.com>
dong jin wrote:
when I finished compiling, and run it, It run well without any problem.
but in fact it has very clear logical error. why? I really appreciate
your sharing this information.
I hope to get message "Segmentation fault", but nothing happened.
Writing past the end of an array does not generate a segmentation fault.
It just clobbers other memory locations. If those clobbered memory
locations contain pointers, and you try to derefence the pointers after
they have been clobbered, then that may generate a segmentation fault.
The C language does not require array bounds checking, and most C
compilers don't implement this by default.
The current gcc design makes it hard to do anything about this kind of
problem, but there is development work addressing this, and hopefully
future gcc versions will handle this better.
--
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com