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: Is it a bug of gcc


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



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