unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: Kenichi Handa <handa@gnu.org>, eggert@cs.ucla.edu, 8215@debbugs.gnu.org
Subject: bug#8215: possibly uninitialized variable lower_xoff in produce_glyphless_glyph
Date: Wed, 02 Jun 2021 16:17:11 +0300	[thread overview]
Message-ID: <83sg20xv6w.fsf@gnu.org> (raw)
In-Reply-To: <87k0ncelmi.fsf@gnus.org> (message from Lars Ingebrigtsen on Wed,  02 Jun 2021 10:06:29 +0200)

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Date: Wed, 02 Jun 2021 10:06:29 +0200
> Cc: 8215@debbugs.gnu.org, Kenichi Handa <handa@m17n.org>
> 
> Paul Eggert <eggert@cs.ucla.edu> 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.





  reply	other threads:[~2021-06-02 13:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-09 22:00 bug#8215: possibly uninitialized variable lower_xoff in produce_glyphless_glyph Paul Eggert
2021-06-02  8:06 ` Lars Ingebrigtsen
2021-06-02 13:17   ` Eli Zaretskii [this message]
2021-06-06  9:00     ` Lars Ingebrigtsen
2021-06-06  9:13       ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83sg20xv6w.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=8215@debbugs.gnu.org \
    --cc=eggert@cs.ucla.edu \
    --cc=handa@gnu.org \
    --cc=larsi@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).