* bug#8512: possibly uninitialized variable in x_produce_glyphs
@ 2011-04-16 19:40 Paul Eggert
2011-04-16 21:24 ` Eli Zaretskii
0 siblings, 1 reply; 3+ messages in thread
From: Paul Eggert @ 2011-04-16 19:40 UTC (permalink / raw)
To: 8512
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;
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#8512: possibly uninitialized variable in x_produce_glyphs
2011-04-16 19:40 bug#8512: possibly uninitialized variable in x_produce_glyphs Paul Eggert
@ 2011-04-16 21:24 ` Eli Zaretskii
2011-04-16 22:49 ` Paul Eggert
0 siblings, 1 reply; 3+ messages in thread
From: Eli Zaretskii @ 2011-04-16 21:24 UTC (permalink / raw)
To: Paul Eggert; +Cc: 8512
> Date: Sat, 16 Apr 2011 12:40:36 -0700
> From: Paul Eggert <eggert@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.
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#8512: possibly uninitialized variable in x_produce_glyphs
2011-04-16 21:24 ` Eli Zaretskii
@ 2011-04-16 22:49 ` Paul Eggert
0 siblings, 0 replies; 3+ messages in thread
From: Paul Eggert @ 2011-04-16 22:49 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 8512-done
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 :-).
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-04-16 22:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-16 19:40 bug#8512: possibly uninitialized variable in x_produce_glyphs Paul Eggert
2011-04-16 21:24 ` Eli Zaretskii
2011-04-16 22:49 ` Paul Eggert
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).