[Bug c/79979] For loop fails to exit

2017-03-09 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79979

Marek Polacek  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 CC||mpolacek at gcc dot gnu.org
 Resolution|--- |INVALID

--- Comment #1 from Marek Polacek  ---
Given the UB you're invoking, all bets are off and the compiler is free to do
anything.  I don't think we want to change anything here.  Even -Warray-bounds
warns here.

[Bug c/79979] For loop fails to exit

2017-03-09 Thread jdowdells at hotmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79979

--- Comment #2 from jdowdells at hotmail dot com ---
Thanks for your quick reply.

However, this is not intuitive, the compiler should be "free to do anything" in
a sensible intuitive manner.

The for loop is well defined and there is no conceivable circumstance that
should allow it to loop forever.

The optimized/unoptimized code should work the same but it does not.

If you want to make the unoptimized code loop for ever I'll be more than happy

Thanks again.

[Bug c/79979] For loop fails to exit

2017-03-09 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79979

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org

--- Comment #3 from Jakub Jelinek  ---
No, undefined behavior means undefined behavior, anything can happen once you
trigger it, it can format your disk, launch missiles, do nothing, do what you
expect, do somethng different.  The compiler optimizes on the assumption that
the code is valid and does not invoke undefined behavior.

[Bug c/79979] For loop fails to exit

2017-03-09 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79979

--- Comment #4 from Jakub Jelinek  ---
Please read e.g. http://blog.regehr.org/archives/213 or other articles about UB
and just fix your code.

[Bug c/79979] For loop fails to exit

2017-03-09 Thread jdowdells at hotmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79979

jdowdells at hotmail dot com changed:

   What|Removed |Added

 Status|RESOLVED|CLOSED

--- Comment #5 from jdowdells at hotmail dot com ---
Thanks for your feedback.