--- Begin Message ---
Subject: |
possibly-uninitialized variables in find_automatic_composition |
Date: |
Fri, 18 Mar 2011 19:12:34 -0700 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.14) Gecko/20110223 Thunderbird/3.1.8 |
Severity: minor
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.
* composite.c (find_automatic_composition): Mark vars as initialized, with a
FIXME.
=== modified file 'src/composite.c'
--- src/composite.c 2011-03-19 00:58:10 +0000
+++ src/composite.c 2011-03-19 01:02:12 +0000
@@ -1489,7 +1489,13 @@
EMACS_INT head, tail, stop;
/* Limit to check a composition after POS. */
EMACS_INT fore_check_limit;
- struct position_record orig, cur, check, prev;
+ struct position_record orig, cur;
+
+ /* FIXME: It's not obvious whether these two variables need initialization.
+ If they do, please supply initial values.
+ If not, please remove this comment. */
+ struct position_record check IF_LINT (= {0}), prev IF_LINT (= {0});
+
Lisp_Object check_val, val, elt;
int c;
Lisp_Object window;
--- End Message ---
--- Begin Message ---
Subject: |
fix merged to trunk |
Date: |
Wed, 23 Mar 2011 15:06:46 -0700 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.15) Gecko/20110307 Fedora/3.1.9-0.39.b3pre.fc14 Thunderbird/3.1.9 |
I committed a fix to the trunk for this,
as part of a recent merge (bzr 103721).
--- End Message ---