This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/32786] Incorrect code compiles and runs well
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 17 Jul 2007 03:17:23 -0000
- Subject: [Bug c++/32786] Incorrect code compiles and runs well
- References: <bug-32786-14864@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #1 from pinskia at gcc dot gnu dot org 2007-07-17 03:17 -------
> the condition in the while loop should cause an infinite loop and should be
> moby*
I think you mean *moby. Anyways it is just undefined that you go past the
array bounds when incrementing a pointer so we know it will not be an infinite
loop and has a finite length.
Anyways the program crashes for me which is a valid behavior.
while(moby != '\0') {
This is valid as '\0' can be considered the NULL pointer.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32786