unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: "Basil L. Contovounesios" <contovob@tcd.ie>
Cc: 51075@debbugs.gnu.org, eggert@cs.ucla.edu
Subject: bug#51075: 29.0.50; Uninitialised variable warning in src/term.c
Date: Thu, 07 Oct 2021 16:01:58 +0300	[thread overview]
Message-ID: <8335pd0z09.fsf@gnu.org> (raw)
In-Reply-To: <87zgrl2idl.fsf@tcd.ie> (bug-gnu-emacs@gnu.org)

> Cc: Paul Eggert <eggert@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@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.





  reply	other threads:[~2021-10-07 13:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-07 11:18 bug#51075: 29.0.50; Uninitialised variable warning in src/term.c Basil L. Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-10-07 13:01 ` Eli Zaretskii [this message]
2021-10-07 20:13   ` Paul Eggert
2021-10-08 10:21     ` Basil L. Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-10-08 10:21   ` Basil L. Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8335pd0z09.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=51075@debbugs.gnu.org \
    --cc=contovob@tcd.ie \
    --cc=eggert@cs.ucla.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).