Subject: Re: bug#51075: 29.0.50; Uninitialised variable warning in src/term.c

From: Paul Eggert <[email-masked]>
Date: Thu, 7 Oct 2021 13:13:33 -0700

On 10/7/21 06:01, Eli Zaretskii wrote:

> It's a bogus warning.  It might be worth reporting to the GCC folks
> (unless GCC 11 already fixed that).

Yes, I believed it's fixed in GCC 11. GCC 11.2.1 20210728 (Red Hat 
11.2.1-1) does not warn me about it.

> Feel free to assign some value to gstring in the 'else' clause, to
> shut up GCC in this case.

I installed into the emacs-28 branch the attached, which fixes it in a 
different way to make it a bit clearer to the reader that we're 
pacifying an inadequate compiler rather than executing odd code for an 
unknown reason.

There are a handful of other bogus warnings with GCC 11.2.1, which I'll 
try to get around to pacifying (I hope before GCC 12 comes out :-).

From ac7bd3f3ec1d12ea255312778d5be674e5fbe293 Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email-masked]>
Date: Thu, 7 Oct 2021 13:09:19 -0700
Subject: [PATCH] Pacify GCC 10.3 -Wmaybe-uninitialized

Problem reported by Basil L. Contovounesios (Bug#51075).
* src/term.c (encode_terminal_code):
Add an UNINIT to pacify GCC 10 bug.
---
 src/term.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/term.c b/src/term.c
index 0858f81685..6f0b827cfc 100644
--- a/src/term.c
+++ b/src/term.c
@@ -550,7 +550,7 @@ encode_terminal_code (struct glyph *src, int src_len,
       if (src->type == COMPOSITE_GLYPH)
 	{
 	  struct composition *cmp;
-	  Lisp_Object gstring;
+	  Lisp_Object gstring UNINIT;
 	  int i;
 
 	  nbytes = buf - encode_terminal_src;
-- 
2.31.1