From unknown Wed Jun 25 02:08:15 2025 X-Loop: help-debbugs@gnu.org Subject: bug#8290: possibly-uninitialized variables in find_automatic_composition 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: To: 8290@debbugs.gnu.org Cc: Kenichi Handa X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.130050078332395 (code B ref -1); Sat, 19 Mar 2011 02:14:01 +0000 Received: (at submit) by debbugs.gnu.org; 19 Mar 2011 02:13:03 +0000 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 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 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 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD autolearn=unavailable version=3.3.1 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 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 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 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 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 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) 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) Message-ID: <4D841112.50403@cs.ucla.edu> Date: Fri, 18 Mar 2011 19:12:34 -0700 From: Paul Eggert Organization: UCLA Computer Science Department User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.14) Gecko/20110223 Thunderbird/3.1.8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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-Received-From: 199.232.76.165 X-Spam-Score: -4.6 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.6 (----) 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; From unknown Wed Jun 25 02:08:15 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.427 (Entity 5.427) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Paul Eggert Subject: bug#8290: closed (fix merged to trunk) Message-ID: References: <4D8A6EF6.6010006@cs.ucla.edu> <4D841112.50403@cs.ucla.edu> X-Gnu-PR-Message: they-closed 8290 X-Gnu-PR-Package: emacs Reply-To: 8290@debbugs.gnu.org Date: Wed, 23 Mar 2011 22:07:08 +0000 Content-Type: multipart/mixed; boundary="----------=_1300918028-30501-1" This is a multi-part message in MIME format... ------------=_1300918028-30501-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #8290: possibly-uninitialized variables in find_automatic_composition 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 8290@debbugs.gnu.org. --=20 8290: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D8290 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1300918028-30501-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 8290-done) by debbugs.gnu.org; 23 Mar 2011 22:07:03 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Q2WCh-0007ur-VF for submit@debbugs.gnu.org; Wed, 23 Mar 2011 18:07:00 -0400 Received: from smtp.cs.ucla.edu ([131.179.128.62]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Q2WCb-0007uA-KO; Wed, 23 Mar 2011 18:06:54 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id 7955339E80F5; Wed, 23 Mar 2011 15:06:47 -0700 (PDT) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu 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 DCQ03AM5OnEs; Wed, 23 Mar 2011 15:06:47 -0700 (PDT) Received: from [131.179.64.200] (Penguin.CS.UCLA.EDU [131.179.64.200]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id 2047839E80B1; Wed, 23 Mar 2011 15:06:47 -0700 (PDT) Message-ID: <4D8A6EF6.6010006@cs.ucla.edu> Date: Wed, 23 Mar 2011 15:06:46 -0700 From: Paul Eggert Organization: UCLA Computer Science Department 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 MIME-Version: 1.0 To: 8310-done@debbugs.gnu.org, 8318-done@debbugs.gnu.org, 8306-done@debbugs.gnu.org, 8303-done@debbugs.gnu.org, 8277-done@debbugs.gnu.org, 8298-done@debbugs.gnu.org, 8290-done@debbugs.gnu.org, 8278-done@debbugs.gnu.org Subject: fix merged to trunk Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Spam-Score: -3.3 (---) X-Debbugs-Envelope-To: 8290-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.3 (---) I committed a fix to the trunk for this, as part of a recent merge (bzr 103721). ------------=_1300918028-30501-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 19 Mar 2011 02:13:03 +0000 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 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 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 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD autolearn=unavailable version=3.3.1 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 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 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 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 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 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) 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) Message-ID: <4D841112.50403@cs.ucla.edu> Date: Fri, 18 Mar 2011 19:12:34 -0700 From: Paul Eggert Organization: UCLA Computer Science Department User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.14) Gecko/20110223 Thunderbird/3.1.8 MIME-Version: 1.0 To: bug-gnu-emacs@gnu.org Subject: possibly-uninitialized variables in find_automatic_composition Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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-Received-From: 199.232.76.165 X-Spam-Score: -4.6 (----) X-Debbugs-Envelope-To: submit Cc: Kenichi Handa X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.6 (----) 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; ------------=_1300918028-30501-1-- From debbugs-submit-bounces@debbugs.gnu.org Thu May 19 01:41:10 2011 Received: (at control) by debbugs.gnu.org; 19 May 2011 05:41:10 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QMvyv-0007NA-SS for submit@debbugs.gnu.org; Thu, 19 May 2011 01:41:10 -0400 Received: from fencepost.gnu.org ([140.186.70.10]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QMvyu-0007Mt-BB for control@debbugs.gnu.org; Thu, 19 May 2011 01:41:08 -0400 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1QMvyo-0007HQ-VM for control@debbugs.gnu.org; Thu, 19 May 2011 01:41:03 -0400 Date: Thu, 19 May 2011 01:41:02 -0400 Message-Id: Subject: control message for bug 8697 To: X-Mailer: mail (GNU Mailutils 2.1) From: Glenn Morris X-Spam-Score: -6.3 (------) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.3 (------) unarchive 8290 forcemerge 8290 8697