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.

Full log


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


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.