From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#9948: valgrind warning: Conditional jump or move depends on uninitialised value(s) in redisplay_window Date: Mon, 07 Nov 2011 01:00:50 -0500 Message-ID: References: <4EB766E8.5050908@cs.ucla.edu> Reply-To: Eli Zaretskii NNTP-Posting-Host: lo.gmane.org X-Trace: dough.gmane.org 1320645680 22434 80.91.229.12 (7 Nov 2011 06:01:20 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 7 Nov 2011 06:01:20 +0000 (UTC) Cc: 9948@debbugs.gnu.org To: Paul Eggert Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Nov 07 07:01:16 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RNIGi-00023a-Iy for geb-bug-gnu-emacs@m.gmane.org; Mon, 07 Nov 2011 07:01:16 +0100 Original-Received: from localhost ([::1]:54556 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RNIGh-0007dF-Pc for geb-bug-gnu-emacs@m.gmane.org; Mon, 07 Nov 2011 01:01:15 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:60906) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RNIGf-0007d4-GG for bug-gnu-emacs@gnu.org; Mon, 07 Nov 2011 01:01:14 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RNIGe-0006QF-Dy for bug-gnu-emacs@gnu.org; Mon, 07 Nov 2011 01:01:13 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:41456) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RNIGe-0006QB-B8 for bug-gnu-emacs@gnu.org; Mon, 07 Nov 2011 01:01:12 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1RNIJN-0003WC-US for bug-gnu-emacs@gnu.org; Mon, 07 Nov 2011 01:04:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 07 Nov 2011 06:04:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 9948 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 9948-submit@debbugs.gnu.org id=B9948.132064582513499 (code B ref 9948); Mon, 07 Nov 2011 06:04:01 +0000 Original-Received: (at 9948) by debbugs.gnu.org; 7 Nov 2011 06:03:45 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RNIJ6-0003Vf-Jk for submit@debbugs.gnu.org; Mon, 07 Nov 2011 01:03:45 -0500 Original-Received: from fencepost.gnu.org ([140.186.70.10]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RNIJ3-0003VX-Ku for 9948@debbugs.gnu.org; Mon, 07 Nov 2011 01:03:43 -0500 Original-Received: from eliz by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1RNIGI-0007Jl-UP; Mon, 07 Nov 2011 01:00:50 -0500 In-reply-to: <4EB766E8.5050908@cs.ucla.edu> (message from Paul Eggert on Sun, 06 Nov 2011 21:04:40 -0800) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Mon, 07 Nov 2011 01:04:01 -0500 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 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.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:53645 Archived-At: > Date: Sun, 06 Nov 2011 21:04:40 -0800 > From: Paul Eggert > > --track-origins=yes should help, but in the meantime, valgrind's > bug report doesn't necessarily mean that no code ever set scrolling_up. > > It could be that scrolling_up was set this way: > > scrolling_up = PT > margin_pos; > > but that margin_pos wasn't properly initialized. For example, suppose > margin_pos was set this way: > > margin_pos = IT_CHARPOS (it1); > > This initialization would not be correct if IT_CHARPOS (it1) referenced > an uninitialized variable. IT_CHARPOS is defined as follows: #define CHARPOS(POS) (POS).charpos #define IT_CHARPOS(IT) CHARPOS ((IT).current.pos) And margin_pos is computed as follows: EMACS_INT margin_pos = CHARPOS (startp); <<<<<<<<<<<<<< int scrolling_up; Lisp_Object aggressive; /* If there is a scroll margin at the top of the window, find its character position. */ if (margin /* Cannot call start_display if startp is not in the accessible region of the buffer. This can happen when we have just switched to a different buffer and/or changed its restriction. In that case, startp is initialized to the character position 1 (BEG) because we did not yet have chance to display the buffer even once. */ && BEGV <= CHARPOS (startp) && CHARPOS (startp) <= ZV) { struct it it1; void *it1data = NULL; SAVE_IT (it1, it, it1data); start_display (&it1, w, startp); move_it_vertically (&it1, margin); margin_pos = IT_CHARPOS (it1); <<<<<<<<<<<<<<<<<< RESTORE_IT (&it, &it, it1data); } scrolling_up = PT > margin_pos; aggressive = scrolling_up ? BVAR (current_buffer, scroll_up_aggressively) : BVAR (current_buffer, scroll_down_aggressively); Both `startp' and `it1' have a valid CHARPOS, the former by virtue of this (near the beginning of the function): SET_TEXT_POS_FROM_MARKER (startp, w->start); and the latter by virtue of the start_display call above, which initializes `it1's character position to `startp'. Again, I don't see how any of this could involve an uninitialized variable.