https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80519
--- Comment #3 from Marc Glisse <glisse at gcc dot gnu.org> --- A warning would be quite a different thing. You would want it in the front-end, to detect when a user literally wrote if(p)free(p). What I am interested in is an optimization that detects when, possibly after inlining and other optimizations, a call to free ends up below a null check, which is normal and should not cause a warning. Since the 2 are unlikely to share any code, I'd suggest filing a separate PR.