3 ms·
I made what I think is a minimal example here: https://godbolt.org/z/dcnzonjar https://godbolt.org/z/dcnzonjar Interestingly I couldn't get it to fail on GCC (
by magpie09 5y ago
I made what I think is a minimal example here: https://godbolt.org/z/dcnzonjar https://godbolt.org/z/dcnzonjar
Interestingly I couldn't get it to fail on GCC (even with -fnoexceptions and -Ofast), only on Clang. Maybe someone else has some info as to why this is?
There is a clear difference in the assembly output for the correct and incorrect implementations, with a testb instruction run much earlier in the correct version. You can see this at line 22 of the output, if you highlight it the && in the source is highlighted in bold.