amazon s2n: let's replace incompetently written C with... slightly smaller amount of incompetently written C what's the point again?
@whitequark Are you sure it's not an almost-clever attempt to prevent memcpy from being optimized out as a nop, by 'using' the return value?
-
-
@RichFelker it's a memset and why would it be optimized out? I think this a better guesshttps://twitter.com/stephentyrone/status/630727331838038016 … -
@whitequark If it's an attempt to clear an object that's about to be freed or whose lifetime is about to end, then memset is a nop. -
@RichFelker That sounds possible but a compiler that can remove that memset will not be stopped by this check :( -
@whitequark In practice it could if the compiler fails to optimize knowledge of the retval; it would make the actual call just to get retval -
@whitequark Not saying it's a good idea but this might be the (misguided) motivation, rather than thinking memset returns !=ptr "on error". -
@RichFelker "misguided" in ANY part of my SSL library is equally horrifying.
End of conversation
New conversation -
-
-
@whitequark Even if so, it's still unsafe against LTO and against optimizing compilers that know memcpy always returns its argument.Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
@RichFelker@whitequark not sure that would be better...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.