https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120001
--- Comment #6 from Vincenzo Romano <vincenzo.romano at gmail dot com> --- MAybe I have not been clear. In cases with -O2 and -O2 the infinite loop is over 2 amoor identical instruction. Maybe I don't know RISC-V architecture that well, but it looks like a bug to me: one amoor should suffice, just like with -Os.