https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84084

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
You are invoking undefined behavior as you correctly noted.  So the compiler is
free to optimize the code by removing the exit test -- i < 2 has to be always
true for a[i] to be not undefined.

I suggest to write (i < 2 && (val = arr[i], true)) instead.

Reply via email to