Note that gcc does the same as clang without the null pointer check (b/c the code is UB), but does right with check added
-
-
Why do you think this is an invalid optimization? Compilers routinely mess with libc functions, e.g. inline memcpy.
-
Because the behavior is changed. A call which necessarily must fail falsely succeeds.
-
The change of behavior is exactly the reason for optimizations.
-
All opt takes place by "as if" rule. Optimizations that violate that are not valid. Changing observable behavior is a bug
-
Sure. Everything boils down to the question what "observable behavior" is.
-
The amount of used memory is not part of observable behavior. In the same way as the execution time is not.
-
I submit this example to youhttps://twitter.com/spun_off/status/731563481007325187 …
-
There are two separate questions here. 1) Objects larger than PTRDIFF_MAX. That's what you discuss mostly. Complex question.
- 3 more replies
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.