https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95656
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> --- I don't see anything wrong on that. You end up with essentially a != nullptr test, which is in some cases optimized away, but during sanitization tests whether some address is non-NULL are intentionally not optimized in case they would end up being NULL (-fsanitize=undefined implies -fno-delete-null-pointer-checks). You get the same result if you use -fno-delete-null-pointer-checks without sanitization.