bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#8227: possibly uninitialized variables in update_window_fringes


From: YAMAMOTO Mitsuharu
Subject: bug#8227: possibly uninitialized variables in update_window_fringes
Date: Fri, 11 Mar 2011 10:31:27 +0900
User-agent: Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.8 (Shij┼Ź) APEL/10.6 Emacs/22.3 (sparc-sun-solaris2.8) MULE/5.0 (SAKAKI)

>>>>> On Thu, 10 Mar 2011 15:45:19 -0800, Paul Eggert <address@hidden> 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
                                address@hidden





reply via email to

[Prev in Thread] Current Thread [Next in Thread]