Subject: Re: possibly-uninitialized variables in find_automatic_composition

From: handa <[email-masked]>
Date: Thu, 19 May 2011 10:32:54 +0900

Very sorry for the late response on this matter.

In article <[email-masked]>, Paul Eggert <[email-masked]> writes:

> In the Emacs trunk, src/composite.c's find_automatic_composition has
> two local variables 'check' and 'prev' that gcc -Wuninitialized warns
> as being possibly being uninitialized when used.  This function has
> multiple gotos and dependencies on data structures that I don't
> understand, so it's not clear to me that GCC is wrong here.  So I'm
> filing a bug report in the hopes that someone more expert can look at it.

> I plan to work around the diagnostic by committing the following
> change, which adds a FIXME comment asking for initial value if needed,
> and for the comment to be removed if the code is OK as-is.  IF_LINT
> is used to tell GCC not to issue a warning here, for now.

> I'm CC:ing this to Kenichi Handa, who committed the code in question,
> to give him a heads-up about the problem.

Actually, those local variables are surely initialized when
used.  But as they are initialized under a specific
condition (e.g. check_val is set to non-nil) and used under
the same condition, it's difficult for gcc to detect that.

Anyway, I've just committed an inproved version of
find_automatic_composition, and gcc won't complain about it
now.

2011-05-18  Kenichi Handa  <[email-masked]>

	* composite.c (CHAR_COMPOSABLE_P): Add more check for efficiency.
	(BACKWARD_CHAR): Wrap the arg STOP by parenthesis.
	(find_automatic_composition): Mostly rewrite for efficiency.

---
Kenichi Handa
[email-masked]