Subject: Re: bug#51172: Fix null-dereference warnings when compiling Emacs with GCC

From: Eli Zaretskii <[email-masked]>
Date: Wed, 13 Oct 2021 15:14:34 +0300

> Date: Tue, 12 Oct 2021 17:34:11 -0700
> From: Paul Eggert <[email-masked]>
> 
> The attached patch against emacs-28 suppresses the final remaining GCC 
> 11.2.1 diagnostics that are emitted after emacs-28 is configured with 
> --enable-gcc-warnings on x86-64.
> 
> The patch is benign, and it's conceivable that changing xmalloc etc. to 
> always return nonnull fixes unlikely and obscure bugs (though I haven't 
> checked this). However, I didn't install the patch into the emacs-28 
> branch on the off-chance that Eli would prefer this sort of thing to be 
> installed into the master branch.

Yes, please install on master.  We don't expect users to configure the
released Emacs with --enable-gcc-warnings, and the changes are
non-trivial.

> -  /* We must call malloc explicitly when BLOCK is 0, since some
> -     reallocs don't do this.  */
> +  /* Call malloc when BLOCK is null,
> +     since lrealloc does not allow a null BLOCK.  */

Typo in this comment: "malloc" should be "lmalloc".

Thanks.