Re:The Value of Undefined Behavior
by tedunangst on Saturday July 21, 2018 @07:14PM
(#17584364)
> This sounds like a classic case of optimizing before measuring.
But you have done the measurements, right?
How would you make machine defined the behaviour of, say, use after free, or data races?
Also compilers normally do not prove that programs hit UB, quite the contrary. Doing that statically is, in general, impossible.
And please, if the compiler can prove that the program invokes UB in "strict-UB" mode, that should be an error, not a cause for the code to be deleted. I'm talking about the case of this SPEC 2006 code [1]
It doesn't make sense to me to just apply potentially disastrous micro-optimizations that save a couple of percent of run-time on the whole program. This sounds like a classic case of optimizing before measuring.
1 https://blog.regehr.org/archives/918