GNU bug report logs - #51172
Fix null-dereference warnings when compiling Emacs with GCC

Previous Next

Package: emacs;

Reported by: Paul Eggert <eggert <at> cs.ucla.edu>

Date: Wed, 13 Oct 2021 00:36:01 UTC

Severity: normal

Tags: patch

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 51172 in the body.
You can then email your comments to 51172 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#51172; Package emacs. (Wed, 13 Oct 2021 00:36:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Paul Eggert <eggert <at> cs.ucla.edu>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 13 Oct 2021 00:36:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Emacs bug reports <bug-gnu-emacs <at> gnu.org>
Subject: Fix null-dereference warnings when compiling Emacs with GCC
Date: Tue, 12 Oct 2021 17:34:11 -0700
[Message part 1 (text/plain, inline)]
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.
[0001-Pacify-GCC-Wanalyzer-possible-null-dereference.patch (text/x-patch, attachment)]

Added tag(s) patch. Request was from Paul Eggert <eggert <at> cs.ucla.edu> to control <at> debbugs.gnu.org. (Wed, 13 Oct 2021 00:46:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51172; Package emacs. (Wed, 13 Oct 2021 12:15:02 GMT) Full text and rfc822 format available.

Message #10 received at 51172 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 51172 <at> debbugs.gnu.org
Subject: Re: bug#51172: Fix null-dereference warnings when compiling Emacs
 with GCC
Date: Wed, 13 Oct 2021 15:14:34 +0300
> Date: Tue, 12 Oct 2021 17:34:11 -0700
> From: Paul Eggert <eggert <at> cs.ucla.edu>
> 
> 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.




Reply sent to Paul Eggert <eggert <at> cs.ucla.edu>:
You have taken responsibility. (Wed, 13 Oct 2021 18:50:02 GMT) Full text and rfc822 format available.

Notification sent to Paul Eggert <eggert <at> cs.ucla.edu>:
bug acknowledged by developer. (Wed, 13 Oct 2021 18:50:02 GMT) Full text and rfc822 format available.

Message #15 received at 51172-done <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 51172-done <at> debbugs.gnu.org
Subject: Re: bug#51172: Fix null-dereference warnings when compiling Emacs
 with GCC
Date: Wed, 13 Oct 2021 11:49:38 -0700
On 10/13/21 5:14 AM, Eli Zaretskii wrote:

> Yes, please install on master.

Thanks, done, and closing the bug report. I also got another diagnostic 
in the master branch, and fixed that in a separate commit.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 11 Nov 2021 12:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 164 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.