https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64877
--- Comment #5 from Manuel López-Ibáñez <manu at gcc dot gnu.org> --- And just for the sake of completion, the warning we trigger is: else if (((code0 == POINTER_TYPE || TYPE_PTRDATAMEM_P (type0)) && null_ptr_cst_p (op1)) /* Handle, eg, (void*)0 (c++/43906), and more. */ || (code0 == POINTER_TYPE && TYPE_PTR_P (type1) && integer_zerop (op1))) { if (TYPE_PTR_P (type1)) result_type = composite_pointer_type (type0, type1, op0, op1, CPO_COMPARISON, complain); else result_type = type0; if (TREE_CODE (op0) == ADDR_EXPR B => && decl_with_nonnull_addr_p (TREE_OPERAND (op0, 0))) { if ((complain & tf_warning) && c_inhibit_evaluation_warnings == 0) warning (OPT_Waddress, "the address of %qD will never be NULL", TREE_OPERAND (op0, 0)); } } It could be enough to test decl_with_nonnull_addr_p (TREE_OPERAND (op0, 0)) to avoid building !op0.pfn when not needed.