News for hackers. Stuff that matters.
Re:Tis-interpreter – find subtle bugs in programs written in... by xyzzy_plugh on Saturday April 09, 2016 @02:48AM (#11460259)
I'm not sure this is correct. I think you are referring to the fact that if p was dereferenced before the NULL-check, then the compiler could optimize out the entire conditional statement.

This is true as dereferencing a NULL pointer is undefined behaviour, so is fair game for optimizations. The compiler may assume that NULL pointer dereferencing results in a trap/segfault and that the conditional can never be executed.

If I am wrong, and your example actually exhibits undefined behaviour, I would certainly love to learn why.

Re:Tis-interpreter – find subtle bugs in programs written in... by kibibu on Saturday April 09, 2016 @03:54AM (#11460420)
Nope, you're right - I meant to dereference the pointer, rather than just access it. D'oh!