GNU bug report logs - #8512
possibly uninitialized variable in x_produce_glyphs

Previous Next

Package: emacs;

Reported by: Paul Eggert <eggert <at> cs.ucla.edu>

Date: Sat, 16 Apr 2011 19:42:02 UTC

Severity: normal

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 8512 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 8512 <at> debbugs.gnu.org
Subject: Re: bug#8512: possibly uninitialized variable in x_produce_glyphs
Date: Sun, 17 Apr 2011 00:24:32 +0300
> Date: Sat, 16 Apr 2011 12:40:36 -0700
> From: Paul Eggert <eggert <at> cs.ucla.edu>
> 
> In the Emacs trunk, GCC 3.4.3 on Solaris 10 warns about a possibly uninitialized
> variable in x_produce_glyphs, and it's not clear to me that this diagnostic is
> wrong.  The function assumes that cmp->glyph_len > 0, but a quick look through the
> rest of Emacs suggests that it's possible that it's zero.  To play it safe
> until someone with more expertise about glyphs can look at the problem, I plan
> to install this patch:
> 
> --- src/xdisp.c	2011-04-16 01:54:37 +0000
> +++ src/xdisp.c	2011-04-16 19:24:11 +0000
> @@ -22712,7 +22712,7 @@ x_produce_glyphs (struct it *it)
>  	  int lbearing, rbearing;
>  	  int i, width, ascent, descent;
>  	  int left_padded = 0, right_padded = 0;
> -	  int c;
> +	  int c = 0; /* FIXME: Is 0 right here, when cmp->glyph_len == 0?  */

I don't think it matters how you initialize c here, because
cmp->glyph_len can never be zero there.  However, using c=0 here is
not right, I think; I would use a printable character, like ' ' or
something, so that get_char_face_and_encoding gets a real character to
play with.




This bug report was last modified 14 years and 97 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.