3 ms·
On a lot of systems load from address zero doesn't segfault, I'm fine with the cpu loading it. I'm disappointed that the new compiler removed the check someone
by mzs 5y ago
On a lot of systems load from address zero doesn't segfault, I'm fine with the cpu loading it. I'm disappointed that the new compiler removed the check someone wrote a dozen years ago to prevent the cpu from overwriting something important though.
- jcranmer 5y agoIn the case where loads from address zero are legal, the dereference-means-non-null-pointer assumption is disabled.
- mzs 5y agoSeems it wasn't disabled in 2009 https://github.com/torvalds/linux/commit/a3ca86aea507904148870946d599e07a340b39bf https://github.com/torvalds/linux/commit/a3ca86aea5079041488...
- jcranmer 5y agoThat case wasn't one of the cases where null pointers are valid memory, judging from the commit message. (There was a case where gcc had a bug where it didn't disable that check properly, but this doesn't appear to be that case.)
- gpderetta 5y agoThe null pointer need not map to address zero exactly to cater to this sort of corner cases.