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

--- Comment #1 from Emil Meissner <e.meissner at seznam dot cz> ---
The code in the attachment, compiled with `g++ file.cpp -o bug -O3 -std=c++20`
produces no assembly for both the `main` and `bsort` function`. (I.e. not even
a `ret` instruction), ultimating in a segmentation fault when run.

The code has an intentional bug in it, where instead of comparing `j <
std::size(arr)` we compare `i < std::size(arr)`. I couldn't further simplify
the example.

Compiling with -O2 and -O1 produces the expected infinite loop.

I suspect this may be exploitable.

Reply via email to