unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#57219: 29.0.50; [PATCH] Fix gcc warning in coding.c
@ 2022-08-14 23:58 Matt Armstrong
  2022-08-15  6:57 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 2+ messages in thread
From: Matt Armstrong @ 2022-08-14 23:58 UTC (permalink / raw)
  To: 57219

[-- Attachment #1: Type: text/plain, Size: 191 bytes --]

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.



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Pacify-warnings-from-gcc-12.patch --]
[-- Type: text/x-diff, Size: 1017 bytes --]

From ae25595681bdec33e271f3804d0ccfae132bb170 Mon Sep 17 00:00:00 2001
From: Matt Armstrong <matt@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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* bug#57219: 29.0.50; [PATCH] Fix gcc warning in coding.c
  2022-08-14 23:58 bug#57219: 29.0.50; [PATCH] Fix gcc warning in coding.c Matt Armstrong
@ 2022-08-15  6:57 ` Lars Ingebrigtsen
  0 siblings, 0 replies; 2+ messages in thread
From: Lars Ingebrigtsen @ 2022-08-15  6:57 UTC (permalink / raw)
  To: Matt Armstrong; +Cc: 57219

Matt Armstrong <matt@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.






^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-08-15  6:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-14 23:58 bug#57219: 29.0.50; [PATCH] Fix gcc warning in coding.c Matt Armstrong
2022-08-15  6:57 ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).