[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#57219: 29.0.50; [PATCH] Fix gcc warning in coding.c
From: |
Matt Armstrong |
Subject: |
bug#57219: 29.0.50; [PATCH] Fix gcc warning in coding.c |
Date: |
Sun, 14 Aug 2022 16:58:08 -0700 |
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.
>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
- bug#57219: 29.0.50; [PATCH] Fix gcc warning in coding.c,
Matt Armstrong <=