Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
Measter
· 1y ago · 0 comments
Only if that memory page is unmapped, and only if the optimizer doesn't detect that it's a null pointer and start deleting verification code because derefing null is UB, and UB is assumed to never happen.
Comments
[–]
charlie90
1y ago
How common is this in practice?
[–]
adrianN
1y ago
Compilers regularly delete null pointer checks when they can see that the pointer is dereferenced.
[–]
Smaug123
1y ago
(GCC controls this with `-fno-delete-null-pointer-checks`
https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html#ind...
)