RUnconcerned 1 day ago

I dunno about what you wrote, but here is one that clearly violates what OP said!

https://godbolt.org/z/Y4Yjb7z9c

clang notices that in the second loop I'm multiplying by 0, and thus the result is just 0, so it just returns that. Critically, this is not "exactly and only what the programmer specifies", since I very much told it to do all those additions and multiplications and it decided to optimize them away.

1
monkeyelite 14 hours ago

What? But the result is the same!