Subject: bug#8512: closed (Re: bug#8512: possibly uninitialized variable in x_produce_glyphs)

From: [email-masked] (GNU bug Tracking System)
Date: Sat, 16 Apr 2011 22:50:03 +0000

Your bug report

#8512: possibly uninitialized variable in x_produce_glyphs

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
8512: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8512
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#8512: possibly uninitialized variable in x_produce_glyphs
From: Paul Eggert <[email-masked]>
To: Eli Zaretskii <[email-masked]>
Cc: [email-masked]
Date: Sat, 16 Apr 2011 15:49:40 -0700
List-Id: <debbugs-submit.debbugs.gnu.org>

On 04/16/2011 02:24 PM, Eli Zaretskii wrote:
> I don't think it matters how you initialize c here, because
> cmp->glyph_len can never be zero there.

Thanks, it was hard for me to tell that.  I'll mark this as
done, then.  I'll add a comment in the code, since it's not
obvious (at least, not to me :-).

Subject: possibly uninitialized variable in x_produce_glyphs
From: Paul Eggert <[email-masked]>
To: [email-masked]
Date: Sat, 16 Apr 2011 12:40:36 -0700
List-Id: <debbugs-submit.debbugs.gnu.org>

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?  */
 	  XChar2b char2b;
 	  struct font_metrics *pcm;
 	  int font_not_found_p;