[Bug target/106068] Infinite loop generated with -mcpu=cortex-m7 and -O2
pinskia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Jun 23 19:56:59 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106068
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Dave Flogeras from comment #2)
> For that code, agreed, and that was indeed both our and upstreams
> workaround. We were just wondering if it was a legitimate compiler bug
> given that it generated an infinite loop in asm. Or does it just fall under
> "undefined"
It is undefined if you access an out of bounds in an array. In this case the
compiler assumes there would be no such access and optimizes the range of n
because of the access and then removes the bounds check as the access already
happened.
So yes it is falls under undefined.
More information about the Gcc-bugs
mailing list