Optimizing away empty loop with step
David Nadlinger
code at klickverbot.at
Fri Jul 30 10:09:55 UTC 2021
On 30 Jul 2021, at 10:58, Vladimir Panteleev via digitalmars-d-ldc
wrote:
> My second guess was that the C compilers were happy with optimizing it
> away because signed integer overflow is undefined in C. But, changing
> the type to unsigned didn't make a difference.
LLVM/Clang 10 didn't optimise it away for me with everything made
unsigned. Clang trunk on Godbolt does, but that's because it makes use
of the fact that infinite loops are UB in C (as encoded in the
`mustprogress` function attribute).
— David
More information about the digitalmars-d-ldc
mailing list