GNU bug report logs -
#51075
29.0.50; Uninitialised variable warning in src/term.c
Previous Next
Full log
View this message in rfc822 format
> Cc: Paul Eggert <eggert <at> cs.ucla.edu>
> Date: Thu, 07 Oct 2021 12:18:14 +0100
> From: "Basil L. Contovounesios" via "Bug reports for GNU Emacs,
> the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
>
> I'm currently seeing the following warning with GCC 10.3.0:
>
> In file included from term.c:30:
> term.c: In function ‘encode_terminal_code’:
> lisp.h:1853:35: warning: ‘gstring’ may be used uninitialized in this function [-Wmaybe-uninitialized]
> 1853 | return XVECTOR (array)->contents[idx];
> | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
> term.c:553:16: note: ‘gstring’ was declared here
> 553 | Lisp_Object gstring;
> | ^~~~~~~
It's a bogus warning. It might be worth reporting to the GCC folks
(unless GCC 11 already fixed that).
> Is
>
> cmp = composition_table[src->u.cmp.id];
>
> indeed guaranteed to be non-NULL?
If it's ever NULL, the very next line will segfault:
cmp = composition_table[src->u.cmp.id];
required = cmp->glyph_len;
> If so, maybe gstring could be
> initialised as nil and then easserted as non-nil in the !cmp branch
> (eassuming cmp is non-NULL in the !src->u.cmp.automatic branch does not
> make the warning go away). If not, could there indeed be a bug?
Feel free to assign some value to gstring in the 'else' clause, to
shut up GCC in this case.
This bug report was last modified 3 years and 305 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.