From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#8215: possibly uninitialized variable lower_xoff in produce_glyphless_glyph Date: Wed, 02 Jun 2021 16:17:11 +0300 Message-ID: <83sg20xv6w.fsf@gnu.org> References: <4D77F86C.9080809@cs.ucla.edu> <87k0ncelmi.fsf@gnus.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4066"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Kenichi Handa , eggert@cs.ucla.edu, 8215@debbugs.gnu.org To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jun 02 15:36:13 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1loR2Z-0000km-Lt for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 02 Jun 2021 15:36:11 +0200 Original-Received: from localhost ([::1]:38210 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1loR2Y-00056p-3y for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 02 Jun 2021 09:36:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35798) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1loQl2-0003fj-Cl for bug-gnu-emacs@gnu.org; Wed, 02 Jun 2021 09:18:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:55921) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1loQkz-0006F0-Un for bug-gnu-emacs@gnu.org; Wed, 02 Jun 2021 09:18:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1loQkz-0000g7-QY for bug-gnu-emacs@gnu.org; Wed, 02 Jun 2021 09:18:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 02 Jun 2021 13:18:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 8215 X-GNU-PR-Package: emacs Original-Received: via spool by 8215-submit@debbugs.gnu.org id=B8215.16226398612577 (code B ref 8215); Wed, 02 Jun 2021 13:18:01 +0000 Original-Received: (at 8215) by debbugs.gnu.org; 2 Jun 2021 13:17:41 +0000 Original-Received: from localhost ([127.0.0.1]:39234 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1loQkb-0000fR-4k for submit@debbugs.gnu.org; Wed, 02 Jun 2021 09:17:41 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:41920) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1loQkW-0000fB-2u for 8215@debbugs.gnu.org; Wed, 02 Jun 2021 09:17:36 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:47600) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1loQkO-00061W-6L; Wed, 02 Jun 2021 09:17:26 -0400 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:4300 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1loQkM-0007D5-5W; Wed, 02 Jun 2021 09:17:23 -0400 In-Reply-To: <87k0ncelmi.fsf@gnus.org> (message from Lars Ingebrigtsen on Wed, 02 Jun 2021 10:06:29 +0200) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:207865 Archived-At: > From: Lars Ingebrigtsen > Date: Wed, 02 Jun 2021 10:06:29 +0200 > Cc: 8215@debbugs.gnu.org, Kenichi Handa > > Paul Eggert writes: > > > In the meantime, I plan to work around the problem by initializing > > lower_xoff to 0, with a FIXME explaining the situation: this shouldn't > > introduce a bug, because at worst it will replace undefined behavior > > with defined behavior. > > It looks like this code is still in place now, ten years later: > > diff --git a/src/xdisp.c b/src/xdisp.c > index 44cb713011..44a317b578 100644 > --- a/src/xdisp.c > +++ b/src/xdisp.c > @@ -22292,7 +22292,13 @@ produce_glyphless_glyph (struct it *it, int for_no_font, Lisp_Object acronym) > if (metrics_upper.width >= metrics_lower.width) > lower_xoff = (width - metrics_lower.width) / 2; > else > - upper_xoff = (width - metrics_upper.width) / 2; > + { > + /* FIXME: This code doesn't look right. It formerly was > + missing the "lower_xoff = 0;", which couldn't have > + been right since it left lower_xoff uninitialized. */ > + lower_xoff = 0; > + upper_xoff = (width - metrics_upper.width) / 2; > + } > } > > /* +5 is for horizontal bars of a box plus 1-pixel spaces at > > Anybody have any insight into whether this is correct or not now? I fixed this (and removed the FIXME with the incorrect initialization). Bottom line: it was a typo.