@thegrugq @johnregehr @i0n1c You are aware that this particular optimization is performed equally by clang and gcc? https://goo.gl/4eCTes
@ch3root @spun_off It looks like subtraction of null pointers from each other might also be gratuitously undefined. :-(
-
-
@ch3root @spun_off Together these leave a lot of real-world programs wit "gratuitous UB" that's hard to fix. -
@ch3root @spun_off You would expect (a||b)?a-b:0 or a==b?0:a-b to yield "a-b without UB" but gcc & llvm fail to collapse the branch. :-( -
@RichFelker @spun_off FTR I think "NULL > NULL" is better than "NULL > ptr", even if still UB. -
@RichFelker @spun_off There is an easy fix for all such UB -- casts to uintptr_t: (uintptr_t)a > (uintptr_t)b etc. Not very elegant though. -
@ch3root I had forgotten about (uintptr_t). It does seem to me less worse than any other alternative. -
@ch3root I have already written a tis-interpreter option to accept (uintptr_t)p<(uintptr_t)q in memmove. I pledge allegiance to uintptr_t!
End of conversation
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.