2 ms·
Wow, that’s crazy. Does anyone have any context on why they didn’t fix this by either disallowing NULL, or not treating the pointer as non-nullable? I’m assumin
by MobiusHorizons 10mo ago
Wow, that’s crazy. Does anyone have any context on why they didn’t fix this by either disallowing NULL, or not treating the pointer as non-nullable? I’m assuming there is code that was expecting this not to error, but the combination really seems like a bug not just a sharp edge.
- jacquesm 10mo agoIndeed, at a minimum you should be able to enforce that check using a compiler flag.
- uecker 10mo agoYou can add that check using -fsanitize=null (and you may want to turn the diagnostic into a run-time trap)
- int_19h 10mo agoTreating the pointer as not-nullable is precisely the point of the feature, though. By letting the compiler know that there's at least N elements there, it can do things like e.g. move that read around and even prefetch if that makes the most sense.