From: Matt Armstrong <matt@rfc20.org>
Date: Mon, 15 Aug 2022 06:56:57 +0000 (+0200)
Subject: Pacify warnings from gcc 12 in encode_coding_object
X-Git-Tag: emacs-29.0.90~1447^2~142
X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=79c0e78460b86d6efef31f65dcb16ab6b89b8551;p=emacs.git

Pacify warnings from gcc 12 in encode_coding_object

* 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 (bug#57219).
---

diff --git a/src/coding.c b/src/coding.c
index 3fb4f148b1c..0ae8eb3282b 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;