https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98975
--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to Jakub Jelinek from comment #6) > That is not what the UB in the testcase is, it is the out of bound accesses > to the array - arr[2] and above. > The bsort function has auto return type, but as there is no return, it is > deduced to be void. And the UB would be there even with j < 3 instead of i > < 3 (and even with j < 2). Whoops I forgot to look the source to see which UB was happening.