From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.bugs Subject: bug#8290: possibly-uninitialized variables in find_automatic_composition Date: Fri, 18 Mar 2011 19:12:34 -0700 Organization: UCLA Computer Science Department Message-ID: <4D841112.50403@cs.ucla.edu> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1300502232 7766 80.91.229.12 (19 Mar 2011 02:37:12 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 19 Mar 2011 02:37:12 +0000 (UTC) To: 8290@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Mar 19 03:37:08 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Q0m2N-0000LA-VK for geb-bug-gnu-emacs@m.gmane.org; Sat, 19 Mar 2011 03:37:08 +0100 Original-Received: from localhost ([127.0.0.1]:49829 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q0m2N-0003Ff-He for geb-bug-gnu-emacs@m.gmane.org; Fri, 18 Mar 2011 22:37:07 -0400 Original-Received: from [140.186.70.92] (port=51095 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q0m2J-0003Fa-6p for bug-gnu-emacs@gnu.org; Fri, 18 Mar 2011 22:37:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q0m2I-0000dX-11 for bug-gnu-emacs@gnu.org; Fri, 18 Mar 2011 22:37:02 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:54985) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q0m2H-0000dT-UT for bug-gnu-emacs@gnu.org; Fri, 18 Mar 2011 22:37:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1Q0lg2-0008Ro-4V; Fri, 18 Mar 2011 22:14:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Paul Eggert Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 19 Mar 2011 02:14:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 8290 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.130050078332395 (code B ref -1); Sat, 19 Mar 2011 02:14:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 19 Mar 2011 02:13:03 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Q0lf4-0008QS-Qx for submit@debbugs.gnu.org; Fri, 18 Mar 2011 22:13:03 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Q0lf2-0008Pz-AF for submit@debbugs.gnu.org; Fri, 18 Mar 2011 22:13:01 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q0lew-0005Es-06 for submit@debbugs.gnu.org; Fri, 18 Mar 2011 22:12:54 -0400 Original-Received: from lists.gnu.org ([199.232.76.165]:43151) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q0lev-0005Em-UF for submit@debbugs.gnu.org; Fri, 18 Mar 2011 22:12:53 -0400 Original-Received: from [140.186.70.92] (port=44036 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q0leu-0000Vp-Ut for bug-gnu-emacs@gnu.org; Fri, 18 Mar 2011 22:12:53 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q0let-0005CZ-RW for bug-gnu-emacs@gnu.org; Fri, 18 Mar 2011 22:12:52 -0400 Original-Received: from smtp.cs.ucla.edu ([131.179.128.62]:60479) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q0let-0005C6-MN for bug-gnu-emacs@gnu.org; Fri, 18 Mar 2011 22:12:51 -0400 Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id A4A7B39E8113; Fri, 18 Mar 2011 19:12:48 -0700 (PDT) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Original-Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id OtO1teOnT9jt; Fri, 18 Mar 2011 19:12:48 -0700 (PDT) Original-Received: from [192.168.1.10] (pool-71-189-109-235.lsanca.fios.verizon.net [71.189.109.235]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id 17F7039E80F2; Fri, 18 Mar 2011 19:12:48 -0700 (PDT) User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.14) Gecko/20110223 Thunderbird/3.1.8 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Fri, 18 Mar 2011 22:14:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:45161 Archived-At: 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;