Undefined behaviour is a complex issue, but compiler devs seem alarmingly unaware that optimising for performance is one choice among many.
@stephenrkell Also, if you write a proper optimizing compiler, you have to go out of your way NOT to "exploit UB" or else badly pessimize.
-
-
@RichFelker That's the conventional wisdom. Problem is I'm a serial doubter. Do you know any experiments that measure this effect? -
@stephenrkell I don't know how to measure the effect, but many historical aliasing/etc hacks I saw were obviously working around bad codegen -
@stephenrkell To quantify you'd need a tool to find such hacks in code from times when compilers were that bad, then guess motive by hand. -
@RichFelker Agreed it's hard to measure. Out of interest, would love to see any examples of said historical hacks.... -
@stephenrkell First example, my own strlen, which is pending either addition of proper may_alias attr or rewrite. http://git.musl-libc.org/cgit/musl/diff/src/string/strlen.c?id=571744447c23f91feb6439948f3a619aca850dfb … -
@RichFelker Thanks... nice example. Will ruminate.
End of conversation
New conversation -
-
-
@stephenrkell And remember, if your compiler generates "inefficient" code ppl will write all sorts of UB hacks to "improve" the output.Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
@stephenrkell Aliasing is probably the most important example of this, but things like potentially-uninitialized vars come up too.Thanks. Twitter will use this to make your timeline better. UndoUndo
-
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.