But it doesn't need a boundary if checked at a stage where the original construct is still accessible. if ptr->member is used before ptr is checked for NULL, throw the warning. Most coding is not going to make a structure that starts at zero. I can imagine doing it in 16-bit real mode code, maybe, but not sure it'd happen even then, and then the warning could be disabled.
This would be useful, and in the kernel, most coders would be surprised by such an optimization and would rather fix the problem or, as has been the case with some truly unnecessary checks, remove them from the source.
I agree that gcc should make it a warning. It may be that it identifies it too late (in optimization) and no longer has line number info?
I also agree this is due to a kernel bug, but a warning could've eliminated that.
"Sometimes insanity is the only alternative" -- button at a Science Fiction convention.