all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
To: Paul Eggert <eggert@cs.ucla.edu>
Cc: 8227@debbugs.gnu.org
Subject: bug#8227: possibly uninitialized variables in update_window_fringes
Date: Fri, 11 Mar 2011 10:31:27 +0900	[thread overview]
Message-ID: <wlwrk6789c.wl%mituharu@math.s.chiba-u.ac.jp> (raw)
In-Reply-To: <4D79628F.3030106@cs.ucla.edu>

>>>>> On Thu, 10 Mar 2011 15:45:19 -0800, Paul Eggert <eggert@cs.ucla.edu> said:

> I found this problem by compiling Emacs with GCC's -Wuninitialized flag.

> The following code in the Emacs trunk src/fringe.c's
> update_window_fringes function might be using uninitialized
> variables:

>    int top_row_ends_at_zv_p, bot_row_ends_at_zv_p;
>    ...
>    if (top_ind_rn >= 0)
>      {
>        ...
>        top_row_ends_at_zv_p = row->ends_at_zv_p;
>      }
>    ...
>    for (y = w->vscroll, rn = 0;
>         y < yb && rn < nrows;
>         y += row->height, rn++)
>      {
>        ...
>        if (WINDOW_LEFT_FRINGE_WIDTH (w) == 0)
> 	...
>        else if (row->left_user_fringe_bitmap != NO_FRINGE_BITMAP)
>          ...
>        else if ((!row->reversed_p && row->truncated_on_left_p)
> 	       || (row->reversed_p && row->truncated_on_right_p))
> 	...
>        else if (row->indicate_bob_p && EQ (boundary_top, Qleft))
> 	{
> 	  left = ((row->indicate_eob_p && EQ (boundary_bot, Qleft))
> 		  ? LEFT_FRINGE (1, Qtop_bottom, top_row_ends_at_zv_p)
> 		  : LEFT_FRINGE (2, Qtop, 0));
>            ...
> 	}

> The last assignment uses top_row_ends_at_zv_p, but it's not clear
> from the previous tests that top_row_ends_at_zv_p must be initialized.
> There is a similar issue with bot_row_ends_at_zv_p.

No problem.  top_ind_rn is set to a non-negative value whenever
row->indicate_bob_p is set.

      for (y = w->vscroll, rn = 0;
	   y < yb && rn < nrows;
	   y += row->height, ++rn)
	{
		...

	  if (!row->mode_line_p)
	    {
	      if (top_ind_rn < 0 && row->visible_height > 0)
		{
		  if (MATRIX_ROW_START_CHARPOS (row) <= BUF_BEGV (XBUFFER (w->buffer))
		      && !MATRIX_ROW_PARTIALLY_VISIBLE_AT_TOP_P (w, row))
		    row->indicate_bob_p = !NILP (boundary_top);
		  else
		    row->indicate_top_line_p = !NILP (arrow_top);
		  top_ind_rn = rn;
		}

				     YAMAMOTO Mitsuharu
				mituharu@math.s.chiba-u.ac.jp





  reply	other threads:[~2011-03-11  1:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-10 23:45 bug#8227: possibly uninitialized variables in update_window_fringes Paul Eggert
2011-03-11  1:31 ` YAMAMOTO Mitsuharu [this message]
2011-03-11  6:25   ` Paul Eggert

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

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

  git send-email \
    --in-reply-to=wlwrk6789c.wl%mituharu@math.s.chiba-u.ac.jp \
    --to=mituharu@math.s.chiba-u.ac.jp \
    --cc=8227@debbugs.gnu.org \
    --cc=eggert@cs.ucla.edu \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.