Re:Null Pointer Dereferencing Causes Undefined Behavior
by nkurz on Tuesday April 21, 2015 @04:41AM
(#9412850)
I like your detailed example, but wouldn't a slightly kinder but equally optimizing compiler simply add a conditional before the load:
I'd even argue the assembly is slightly better when interpreted this way, since branch prediction will tend execute the load or not as appropriate, rather than potentially taking a unnecessary TLB miss for a load that's never used.
[ Parent
| on HN ]
There are no comments on this comment yet.