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]

[Bug c++/32786] Incorrect code compiles and runs well



------- 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


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