https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115944
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> --- Dereferencing a null pointer has undefined behaviour, so the compiler can assume that function is never called. I don't think that's a bug.