https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77298
Manuel López-Ibáñez <manu at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED CC| |manu at gcc dot gnu.org Resolution|--- |INVALID --- Comment #1 from Manuel López-Ibáñez <manu at gcc dot gnu.org> --- This is by design. Most users do not want to get warnings for code that is not reachable or if the thing compared against NULL has changed and become NULL (https://gcc.gnu.org/PR69835). In your case, the whole function gets optimized out. This is similar to: if (false) { if (this != 0) return handle; }