GNU bug report logs - #57219
29.0.50; [PATCH] Fix gcc warning in coding.c

Previous Next

Package: emacs;

Reported by: Matt Armstrong <matt <at> rfc20.org>

Date: Sun, 14 Aug 2022 23:59:02 UTC

Severity: normal

Tags: patch

Found in version 29.0.50

Fixed in version 29.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

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 57219 in the body.
You can then email your comments to 57219 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#57219; Package emacs. (Sun, 14 Aug 2022 23:59:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Matt Armstrong <matt <at> rfc20.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 14 Aug 2022 23:59:02 GMT) Full text and rfc822 format available.

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

From: Matt Armstrong <matt <at> rfc20.org>
To: bug-gnu-emacs <at> gnu.org
Subject: 29.0.50; [PATCH] Fix gcc warning in coding.c
Date: Sun, 14 Aug 2022 16:58:08 -0700
[Message part 1 (text/plain, inline)]
gcc 12 is warning about a possible uninitialized variable in coding.c.
Looks like Paul fixed the same warning in a nearby function years ago,
so I used the same suppression technique here.


[0001-Pacify-warnings-from-gcc-12.patch (text/x-diff, inline)]
From ae25595681bdec33e271f3804d0ccfae132bb170 Mon Sep 17 00:00:00 2001
From: Matt Armstrong <matt <at> rfc20.org>
Date: Sun, 14 Aug 2022 16:41:56 -0700
Subject: [PATCH] Pacify warnings from gcc 12

* src/coding.c (encode_coding_object): Mark saved_pt_byte with UNINIT
to silence a false alarm from -Wmaybe-uninitialized.  This was already
done in decode_coding_object.  The fix is correct because saved_pt is
used as a sentinel before saved_pt_byte is used.
---
 src/coding.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/coding.c b/src/coding.c
index 3fb4f148b1..0ae8eb3282 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -8283,7 +8283,7 @@ encode_coding_object (struct coding_system *coding,
   ptrdiff_t chars = to - from;
   ptrdiff_t bytes = to_byte - from_byte;
   Lisp_Object attrs;
-  ptrdiff_t saved_pt = -1, saved_pt_byte;
+  ptrdiff_t saved_pt = -1, saved_pt_byte UNINIT;
   bool need_marker_adjustment = 0;
   bool kill_src_buffer = 0;
   Lisp_Object old_deactivate_mark;
-- 
2.35.1


Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#57219; Package emacs. (Mon, 15 Aug 2022 06:58:02 GMT) Full text and rfc822 format available.

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

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Matt Armstrong <matt <at> rfc20.org>
Cc: 57219 <at> debbugs.gnu.org
Subject: Re: bug#57219: 29.0.50; [PATCH] Fix gcc warning in coding.c
Date: Mon, 15 Aug 2022 08:57:13 +0200
Matt Armstrong <matt <at> rfc20.org> writes:

> gcc 12 is warning about a possible uninitialized variable in coding.c.
> Looks like Paul fixed the same warning in a nearby function years ago,
> so I used the same suppression technique here.

Thanks; pushed to Emacs 29.





bug marked as fixed in version 29.1, send any further explanations to 57219 <at> debbugs.gnu.org and Matt Armstrong <matt <at> rfc20.org> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Mon, 15 Aug 2022 06:58:03 GMT) Full text and rfc822 format available.

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

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

Previous Next


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