From unknown Sat Aug 16 18:15:33 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#8512 <8512@debbugs.gnu.org> To: bug#8512 <8512@debbugs.gnu.org> Subject: Status: possibly uninitialized variable in x_produce_glyphs Reply-To: bug#8512 <8512@debbugs.gnu.org> Date: Sun, 17 Aug 2025 01:15:33 +0000 retitle 8512 possibly uninitialized variable in x_produce_glyphs reassign 8512 emacs submitter 8512 Paul Eggert severity 8512 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Sat Apr 16 15:41:03 2011 Received: (at submit) by debbugs.gnu.org; 16 Apr 2011 19:41: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 1QBBMd-0007XZ-Ej for submit@debbugs.gnu.org; Sat, 16 Apr 2011 15:41:03 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QBBMa-0007X2-Sy for submit@debbugs.gnu.org; Sat, 16 Apr 2011 15:41:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QBBMV-0007Hq-1i for submit@debbugs.gnu.org; Sat, 16 Apr 2011 15:40:55 -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 ([140.186.70.17]:45941) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QBBMV-0007Hl-08 for submit@debbugs.gnu.org; Sat, 16 Apr 2011 15:40:55 -0400 Received: from eggs.gnu.org ([140.186.70.92]:39019) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QBBMU-0003Ug-3n for bug-gnu-emacs@gnu.org; Sat, 16 Apr 2011 15:40:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QBBMT-0007HQ-Ee for bug-gnu-emacs@gnu.org; Sat, 16 Apr 2011 15:40:54 -0400 Received: from smtp.cs.ucla.edu ([131.179.128.62]:49540) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QBBMT-0007Fu-9V for bug-gnu-emacs@gnu.org; Sat, 16 Apr 2011 15:40:53 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id D352D39E80F7 for ; Sat, 16 Apr 2011 12:40:43 -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 NGm1Resx1Ebr for ; Sat, 16 Apr 2011 12:40:43 -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 5FEBB39E80DB for ; Sat, 16 Apr 2011 12:40:43 -0700 (PDT) Message-ID: <4DA9F0B4.1090204@cs.ucla.edu> Date: Sat, 16 Apr 2011 12:40:36 -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 variable in x_produce_glyphs 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, 3) X-Received-From: 140.186.70.17 X-Spam-Score: -4.7 (----) X-Debbugs-Envelope-To: submit 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.7 (----) 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; From debbugs-submit-bounces@debbugs.gnu.org Sat Apr 16 17:26:12 2011 Received: (at 8512) by debbugs.gnu.org; 16 Apr 2011 21:26:12 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QBD0O-0001TE-38 for submit@debbugs.gnu.org; Sat, 16 Apr 2011 17:26:12 -0400 Received: from mtaout22.012.net.il ([80.179.55.172]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QBD0L-0001Sz-Go for 8512@debbugs.gnu.org; Sat, 16 Apr 2011 17:26:10 -0400 Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0LJR00400K7BG400@a-mtaout22.012.net.il> for 8512@debbugs.gnu.org; Sun, 17 Apr 2011 00:24:33 +0300 (IDT) Received: from HOME-C4E4A596F7 ([77.124.96.168]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0LJR003KBKSVWWF0@a-mtaout22.012.net.il>; Sun, 17 Apr 2011 00:24:33 +0300 (IDT) Date: Sun, 17 Apr 2011 00:24:32 +0300 From: Eli Zaretskii Subject: Re: bug#8512: possibly uninitialized variable in x_produce_glyphs In-reply-to: <4DA9F0B4.1090204@cs.ucla.edu> X-012-Sender: halo1@inter.net.il To: Paul Eggert Message-id: <831v11q48f.fsf@gnu.org> References: <4DA9F0B4.1090204@cs.ucla.edu> X-Spam-Score: -2.1 (--) X-Debbugs-Envelope-To: 8512 Cc: 8512@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Reply-To: Eli Zaretskii 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: -2.1 (--) > Date: Sat, 16 Apr 2011 12:40:36 -0700 > From: Paul Eggert > > 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. From debbugs-submit-bounces@debbugs.gnu.org Sat Apr 16 18:49:49 2011 Received: (at 8512-done) by debbugs.gnu.org; 16 Apr 2011 22:49:49 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QBEJI-0003G3-Q5 for submit@debbugs.gnu.org; Sat, 16 Apr 2011 18:49:49 -0400 Received: from smtp.cs.ucla.edu ([131.179.128.62]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QBEJG-0003Fr-IO for 8512-done@debbugs.gnu.org; Sat, 16 Apr 2011 18:49:47 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id E81D039E80F7; Sat, 16 Apr 2011 15:49:40 -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 vG2l5WHxGXUJ; Sat, 16 Apr 2011 15:49:40 -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 976BD39E80DB; Sat, 16 Apr 2011 15:49:40 -0700 (PDT) Message-ID: <4DAA1D04.7040007@cs.ucla.edu> Date: Sat, 16 Apr 2011 15:49:40 -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: Eli Zaretskii Subject: Re: bug#8512: possibly uninitialized variable in x_produce_glyphs References: <4DA9F0B4.1090204@cs.ucla.edu> <831v11q48f.fsf@gnu.org> In-Reply-To: <831v11q48f.fsf@gnu.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Score: -3.0 (---) X-Debbugs-Envelope-To: 8512-done Cc: 8512-done@debbugs.gnu.org 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.0 (---) 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 :-). From unknown Sat Aug 16 18:15:33 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sun, 15 May 2011 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator