GNU bug report logs - #9990
valgrind warning in add_row_entry

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Dan Nicolaescu <dann@HIDDEN>; dated Tue, 8 Nov 2011 14:31:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 9990 <at> debbugs.gnu.org:


Received: (at 9990) by debbugs.gnu.org; 20 Nov 2011 21:31:44 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Nov 20 16:31:44 2011
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1RSEzI-0006Bk-BJ
	for submit <at> debbugs.gnu.org; Sun, 20 Nov 2011 16:31:44 -0500
Received: from fencepost.gnu.org ([140.186.70.10])
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <dann@HIDDEN>) id 1RSEzG-0006Bd-Ov
	for 9990 <at> debbugs.gnu.org; Sun, 20 Nov 2011 16:31:43 -0500
Received: from dann by fencepost.gnu.org with local (Exim 4.71)
	(envelope-from <dann@HIDDEN>)
	id 1RSEy8-0003h5-0o; Sun, 20 Nov 2011 16:30:32 -0500
From: Dan Nicolaescu <dann@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#9990: valgrind warning in add_row_entry
References: <yxqwrbaadvp.fsf@HIDDEN> <83k47ailf0.fsf@HIDDEN>
	<yxqpqgzrym5.fsf@HIDDEN> <83zkg2fzgt.fsf@HIDDEN>
	<83vcqqfy5h.fsf@HIDDEN> <yxqy5vml8cc.fsf@HIDDEN>
	<83k475fsxp.fsf@HIDDEN> <yxq1ut91fw5.fsf@HIDDEN>
	<83zkftbnwx.fsf@HIDDEN> <yxqlirdrzgt.fsf@HIDDEN>
	<83wraxb0ko.fsf@HIDDEN> <yxq7h2xm7io.fsf@HIDDEN>
	<83sjlkbjok.fsf@HIDDEN>
Date: Sun, 20 Nov 2011 16:30:31 -0500
In-Reply-To: <83sjlkbjok.fsf@HIDDEN> (Eli Zaretskii's message of "Sat, 19 Nov
	2011 10:28:11 +0200")
Message-ID: <yxq1ut2xz0o.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Spam-Score: -6.6 (------)
X-Debbugs-Envelope-To: 9990
Cc: 9990 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -6.6 (------)

Eli Zaretskii <eliz@HIDDEN> writes:

>> From: Dan Nicolaescu <dann@HIDDEN>
>> Cc: 9990 <at> debbugs.gnu.org
>> Date: Fri, 18 Nov 2011 16:43:11 -0500
>> 
>> >> Unfortunately it still complains in:
>> >> 
>> >> ==11270==    at 0x41314F: adjust_glyph_matrix (dispnew.c:612)
>> >
>> > What does this line say in your sources?
>> >
>> 
>>               xassert (!row->enabled_p || verify_row_hash (row));
>
> So it complains about `row' itself, or maybe about the enabled_p
> field, is that right?

It's either row, row->enabled_p or row->hash.  (In case the warning is
valid...)




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#9990; Package emacs. Full text available.

Message received at 9990 <at> debbugs.gnu.org:


Received: (at 9990) by debbugs.gnu.org; 19 Nov 2011 08:31:13 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Nov 19 03:31:13 2011
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1RRgKO-0005XA-8r
	for submit <at> debbugs.gnu.org; Sat, 19 Nov 2011 03:31:12 -0500
Received: from mtaout22.012.net.il ([80.179.55.172])
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <eliz@HIDDEN>) id 1RRgKL-0005Wv-8g
	for 9990 <at> debbugs.gnu.org; Sat, 19 Nov 2011 03:31:10 -0500
Received: from conversion-daemon.a-mtaout22.012.net.il by
	a-mtaout22.012.net.il (HyperSendmail v2007.08) id
	<0LUW00600F1QH000@HIDDEN> for
	9990 <at> debbugs.gnu.org; Sat, 19 Nov 2011 10:30:02 +0200 (IST)
Received: from HOME-C4E4A596F7 ([77.127.237.133]) by a-mtaout22.012.net.il
	(HyperSendmail v2007.08) with ESMTPA id
	<0LUW005UZFLZY0B0@HIDDEN>;
	Sat, 19 Nov 2011 10:30:00 +0200 (IST)
Date: Sat, 19 Nov 2011 10:28:11 +0200
From: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#9990: valgrind warning in add_row_entry
In-reply-to: <yxq7h2xm7io.fsf@HIDDEN>
X-012-Sender: halo1@HIDDEN
To: Dan Nicolaescu <dann@HIDDEN>
Message-id: <83sjlkbjok.fsf@HIDDEN>
References: <yxqwrbaadvp.fsf@HIDDEN> <83k47ailf0.fsf@HIDDEN>
	<yxqpqgzrym5.fsf@HIDDEN> <83zkg2fzgt.fsf@HIDDEN>
	<83vcqqfy5h.fsf@HIDDEN> <yxqy5vml8cc.fsf@HIDDEN>
	<83k475fsxp.fsf@HIDDEN> <yxq1ut91fw5.fsf@HIDDEN>
	<83zkftbnwx.fsf@HIDDEN> <yxqlirdrzgt.fsf@HIDDEN>
	<83wraxb0ko.fsf@HIDDEN> <yxq7h2xm7io.fsf@HIDDEN>
X-Spam-Score: -2.0 (--)
X-Debbugs-Envelope-To: 9990
Cc: 9990 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
Reply-To: Eli Zaretskii <eliz@HIDDEN>
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -2.0 (--)

> From: Dan Nicolaescu <dann@HIDDEN>
> Cc: 9990 <at> debbugs.gnu.org
> Date: Fri, 18 Nov 2011 16:43:11 -0500
> 
> >> Unfortunately it still complains in:
> >> 
> >> ==11270==    at 0x41314F: adjust_glyph_matrix (dispnew.c:612)
> >
> > What does this line say in your sources?
> >
> 
>               xassert (!row->enabled_p || verify_row_hash (row));

So it complains about `row' itself, or maybe about the enabled_p
field, is that right?

> And for the other complaint:
> ==11270==    by 0x415762: update_window (dispnew.c:4244)
> 
> is:
>    ptrdiff_t i = row->hash % row_table_size;

Yes, that was the original one, triggered by "C-h H".  But maybe it is
complaining about `row' itself, even here, not about the hash code?  I
will take another look.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#9990; Package emacs. Full text available.

Message received at 9990 <at> debbugs.gnu.org:


Received: (at 9990) by debbugs.gnu.org; 18 Nov 2011 21:44:15 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Nov 18 16:44:15 2011
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1RRWEI-0007gF-UY
	for submit <at> debbugs.gnu.org; Fri, 18 Nov 2011 16:44:15 -0500
Received: from fencepost.gnu.org ([140.186.70.10])
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <dann@HIDDEN>) id 1RRWEE-0007g5-1y
	for 9990 <at> debbugs.gnu.org; Fri, 18 Nov 2011 16:44:11 -0500
Received: from dann by fencepost.gnu.org with local (Exim 4.71)
	(envelope-from <dann@HIDDEN>)
	id 1RRWDH-00048c-3K; Fri, 18 Nov 2011 16:43:11 -0500
From: Dan Nicolaescu <dann@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#9990: valgrind warning in add_row_entry
References: <yxqwrbaadvp.fsf@HIDDEN> <83k47ailf0.fsf@HIDDEN>
	<yxqpqgzrym5.fsf@HIDDEN> <83zkg2fzgt.fsf@HIDDEN>
	<83vcqqfy5h.fsf@HIDDEN> <yxqy5vml8cc.fsf@HIDDEN>
	<83k475fsxp.fsf@HIDDEN> <yxq1ut91fw5.fsf@HIDDEN>
	<83zkftbnwx.fsf@HIDDEN> <yxqlirdrzgt.fsf@HIDDEN>
	<83wraxb0ko.fsf@HIDDEN>
Date: Fri, 18 Nov 2011 16:43:11 -0500
In-Reply-To: <83wraxb0ko.fsf@HIDDEN> (Eli Zaretskii's message of "Fri, 18 Nov
	2011 23:08:39 +0200")
Message-ID: <yxq7h2xm7io.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Spam-Score: -6.6 (------)
X-Debbugs-Envelope-To: 9990
Cc: 9990 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -6.6 (------)

Eli Zaretskii <eliz@HIDDEN> writes:

>> From: Dan Nicolaescu <dann@HIDDEN>
>> Cc: 9990 <at> debbugs.gnu.org
>> Date: Fri, 18 Nov 2011 14:40:34 -0500
>> 
>> > I added such an assert to the trunk.  I also fixed a couple of
>> > functions that were destroying the validity of hash codes while
>> > manipulating glyph rows.
>> >
>> > Could you please see if valgrind still complains about add_row_entry
>> > with the current trunk?
>> 
>> Unfortunately it still complains in:
>> 
>> ==11270==    at 0x41314F: adjust_glyph_matrix (dispnew.c:612)
>
> What does this line say in your sources?
>

              xassert (!row->enabled_p || verify_row_hash (row));

> Anyway, seems like a different thing, as there's no add_row_entry near
> line 612.

And for the other complaint:
==11270==    by 0x415762: update_window (dispnew.c:4244)

is:
   ptrdiff_t i = row->hash % row_table_size;





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#9990; Package emacs. Full text available.

Message received at 9990 <at> debbugs.gnu.org:


Received: (at 9990) by debbugs.gnu.org; 18 Nov 2011 21:12:38 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Nov 18 16:12:38 2011
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1RRVji-0006CM-CK
	for submit <at> debbugs.gnu.org; Fri, 18 Nov 2011 16:12:38 -0500
Received: from mtaout22.012.net.il ([80.179.55.172])
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <eliz@HIDDEN>) id 1RRVjg-0006CE-Ty
	for 9990 <at> debbugs.gnu.org; Fri, 18 Nov 2011 16:12:37 -0500
Received: from conversion-daemon.a-mtaout22.012.net.il by
	a-mtaout22.012.net.il (HyperSendmail v2007.08) id
	<0LUV00100JYP8R00@HIDDEN> for
	9990 <at> debbugs.gnu.org; Fri, 18 Nov 2011 23:10:29 +0200 (IST)
Received: from HOME-C4E4A596F7 ([77.127.237.133]) by a-mtaout22.012.net.il
	(HyperSendmail v2007.08) with ESMTPA id
	<0LUV001OTK5G6Y30@HIDDEN>;
	Fri, 18 Nov 2011 23:10:29 +0200 (IST)
Date: Fri, 18 Nov 2011 23:08:39 +0200
From: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#9990: valgrind warning in add_row_entry
In-reply-to: <yxqlirdrzgt.fsf@HIDDEN>
X-012-Sender: halo1@HIDDEN
To: Dan Nicolaescu <dann@HIDDEN>
Message-id: <83wraxb0ko.fsf@HIDDEN>
References: <yxqwrbaadvp.fsf@HIDDEN> <83k47ailf0.fsf@HIDDEN>
	<yxqpqgzrym5.fsf@HIDDEN> <83zkg2fzgt.fsf@HIDDEN>
	<83vcqqfy5h.fsf@HIDDEN> <yxqy5vml8cc.fsf@HIDDEN>
	<83k475fsxp.fsf@HIDDEN> <yxq1ut91fw5.fsf@HIDDEN>
	<83zkftbnwx.fsf@HIDDEN> <yxqlirdrzgt.fsf@HIDDEN>
X-Spam-Score: -2.0 (--)
X-Debbugs-Envelope-To: 9990
Cc: 9990 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
Reply-To: Eli Zaretskii <eliz@HIDDEN>
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -2.0 (--)

> From: Dan Nicolaescu <dann@HIDDEN>
> Cc: 9990 <at> debbugs.gnu.org
> Date: Fri, 18 Nov 2011 14:40:34 -0500
> 
> > I added such an assert to the trunk.  I also fixed a couple of
> > functions that were destroying the validity of hash codes while
> > manipulating glyph rows.
> >
> > Could you please see if valgrind still complains about add_row_entry
> > with the current trunk?
> 
> Unfortunately it still complains in:
> 
> ==11270==    at 0x41314F: adjust_glyph_matrix (dispnew.c:612)

What does this line say in your sources?

Anyway, seems like a different thing, as there's no add_row_entry near
line 612.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#9990; Package emacs. Full text available.

Message received at 9990 <at> debbugs.gnu.org:


Received: (at 9990) by debbugs.gnu.org; 18 Nov 2011 19:41:38 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Nov 18 14:41:38 2011
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1RRUJe-0003rY-84
	for submit <at> debbugs.gnu.org; Fri, 18 Nov 2011 14:41:38 -0500
Received: from fencepost.gnu.org ([140.186.70.10])
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <dann@HIDDEN>) id 1RRUJY-0003rO-TL
	for 9990 <at> debbugs.gnu.org; Fri, 18 Nov 2011 14:41:35 -0500
Received: from dann by fencepost.gnu.org with local (Exim 4.71)
	(envelope-from <dann@HIDDEN>)
	id 1RRUIc-0003sh-A3; Fri, 18 Nov 2011 14:40:34 -0500
From: Dan Nicolaescu <dann@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#9990: valgrind warning in add_row_entry
References: <yxqwrbaadvp.fsf@HIDDEN> <83k47ailf0.fsf@HIDDEN>
	<yxqpqgzrym5.fsf@HIDDEN> <83zkg2fzgt.fsf@HIDDEN>
	<83vcqqfy5h.fsf@HIDDEN> <yxqy5vml8cc.fsf@HIDDEN>
	<83k475fsxp.fsf@HIDDEN> <yxq1ut91fw5.fsf@HIDDEN>
	<83zkftbnwx.fsf@HIDDEN>
Date: Fri, 18 Nov 2011 14:40:34 -0500
In-Reply-To: <83zkftbnwx.fsf@HIDDEN> (Eli Zaretskii's message of "Fri, 18 Nov
	2011 14:44:30 +0200")
Message-ID: <yxqlirdrzgt.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Spam-Score: -6.6 (------)
X-Debbugs-Envelope-To: 9990
Cc: 9990 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -6.6 (------)

Eli Zaretskii <eliz@HIDDEN> writes:

>> From: Dan Nicolaescu <dann@HIDDEN>
>> Cc: 9990 <at> debbugs.gnu.org
>> Date: Tue, 15 Nov 2011 11:58:50 -0500
>> 
>> > If the hash values are always correct where they are used, I guess
>> > that excludes the possibility that we use an uninitialized value,
>> > right?
>> 
>> I even added an  xassert (verify_row_hash (row)) in add_row_entry, and
>> it does not trigger.  Strange...
>
> I added such an assert to the trunk.  I also fixed a couple of
> functions that were destroying the validity of hash codes while
> manipulating glyph rows.
>
> Could you please see if valgrind still complains about add_row_entry
> with the current trunk?

Unfortunately it still complains in:

==11270==    at 0x41314F: adjust_glyph_matrix (dispnew.c:612)
==11270==    by 0x4135FC: allocate_matrices_for_window_redisplay (dispnew.c:1869)
==11270==    by 0x413B8A: adjust_frame_glyphs (dispnew.c:2199)
==11270==    by 0x417137: adjust_glyphs (dispnew.c:1897)
==11270==    by 0x44243E: redisplay_internal (xdisp.c:12715)
==11270==    by 0x4F6CE2: command_loop_1 (keyboard.c:1589)
==11270==    by 0x55BB45: internal_condition_case (eval.c:1499)
==11270==    by 0x4E9EAD: command_loop_2 (keyboard.c:1158)
==11270==    by 0x55BA27: internal_catch (eval.c:1256)
==11270==    by 0x4EB436: recursive_edit_1 (keyboard.c:1137)
==11270==    by 0x4EB76B: Frecursive_edit (keyboard.c:821)
==11270==    by 0x40E62C: main (emacs.c:1707)

==11270==    by 0x415762: update_window (dispnew.c:4244)
==11270==    by 0x4166C2: update_window_tree (dispnew.c:3360)
==11270==    by 0x418617: update_frame (dispnew.c:3287)
==11270==    by 0x44207B: redisplay_internal (xdisp.c:13175)
==11270==    by 0x4F6CE2: command_loop_1 (keyboard.c:1589)
==11270==    by 0x55BB45: internal_condition_case (eval.c:1499)
==11270==    by 0x4E9EAD: command_loop_2 (keyboard.c:1158)
==11270==    by 0x55BA27: internal_catch (eval.c:1256)
==11270==    by 0x4EB436: recursive_edit_1 (keyboard.c:1137)

[line numbers in dispnew.c might be off by a few lines, I have some
debugging printfs inserted there]




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#9990; Package emacs. Full text available.

Message received at 9990 <at> debbugs.gnu.org:


Received: (at 9990) by debbugs.gnu.org; 18 Nov 2011 12:47:35 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Nov 18 07:47:35 2011
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1RRNqx-0002dh-KT
	for submit <at> debbugs.gnu.org; Fri, 18 Nov 2011 07:47:35 -0500
Received: from mtaout21.012.net.il ([80.179.55.169])
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <eliz@HIDDEN>) id 1RRNqu-0002dZ-TV
	for 9990 <at> debbugs.gnu.org; Fri, 18 Nov 2011 07:47:34 -0500
Received: from conversion-daemon.a-mtaout21.012.net.il by
	a-mtaout21.012.net.il (HyperSendmail v2007.08) id
	<0LUU00800WSP6400@HIDDEN> for
	9990 <at> debbugs.gnu.org; Fri, 18 Nov 2011 14:46:20 +0200 (IST)
Received: from HOME-C4E4A596F7 ([77.127.237.133]) by a-mtaout21.012.net.il
	(HyperSendmail v2007.08) with ESMTPA id
	<0LUU007S5WT7YH60@HIDDEN>;
	Fri, 18 Nov 2011 14:46:20 +0200 (IST)
Date: Fri, 18 Nov 2011 14:44:30 +0200
From: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#9990: valgrind warning in add_row_entry
In-reply-to: <yxq1ut91fw5.fsf@HIDDEN>
X-012-Sender: halo1@HIDDEN
To: Dan Nicolaescu <dann@HIDDEN>
Message-id: <83zkftbnwx.fsf@HIDDEN>
References: <yxqwrbaadvp.fsf@HIDDEN> <83k47ailf0.fsf@HIDDEN>
	<yxqpqgzrym5.fsf@HIDDEN> <83zkg2fzgt.fsf@HIDDEN>
	<83vcqqfy5h.fsf@HIDDEN> <yxqy5vml8cc.fsf@HIDDEN>
	<83k475fsxp.fsf@HIDDEN> <yxq1ut91fw5.fsf@HIDDEN>
X-Spam-Score: -2.0 (--)
X-Debbugs-Envelope-To: 9990
Cc: 9990 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
Reply-To: Eli Zaretskii <eliz@HIDDEN>
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -2.0 (--)

> From: Dan Nicolaescu <dann@HIDDEN>
> Cc: 9990 <at> debbugs.gnu.org
> Date: Tue, 15 Nov 2011 11:58:50 -0500
> 
> > If the hash values are always correct where they are used, I guess
> > that excludes the possibility that we use an uninitialized value,
> > right?
> 
> I even added an  xassert (verify_row_hash (row)) in add_row_entry, and
> it does not trigger.  Strange...

I added such an assert to the trunk.  I also fixed a couple of
functions that were destroying the validity of hash codes while
manipulating glyph rows.

Could you please see if valgrind still complains about add_row_entry
with the current trunk?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#9990; Package emacs. Full text available.

Message received at 9990 <at> debbugs.gnu.org:


Received: (at 9990) by debbugs.gnu.org; 15 Nov 2011 17:52:35 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Nov 15 12:52:35 2011
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1RQNBS-0006Vb-Q2
	for submit <at> debbugs.gnu.org; Tue, 15 Nov 2011 12:52:35 -0500
Received: from mtaout20.012.net.il ([80.179.55.166])
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <eliz@HIDDEN>) id 1RQNBL-0006Ui-Ny
	for 9990 <at> debbugs.gnu.org; Tue, 15 Nov 2011 12:52:33 -0500
Received: from conversion-daemon.a-mtaout20.012.net.il by
	a-mtaout20.012.net.il (HyperSendmail v2007.08) id
	<0LUP00M00QRC8D00@HIDDEN> for
	9990 <at> debbugs.gnu.org; Tue, 15 Nov 2011 19:51:41 +0200 (IST)
Received: from HOME-C4E4A596F7 ([77.124.184.15]) by a-mtaout20.012.net.il
	(HyperSendmail v2007.08) with ESMTPA id
	<0LUP00HA6QY3C0I1@HIDDEN>;
	Tue, 15 Nov 2011 19:51:39 +0200 (IST)
Date: Tue, 15 Nov 2011 19:49:46 +0200
From: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#9990: valgrind warning in add_row_entry
In-reply-to: <yxqpqgte1xn.fsf@HIDDEN>
X-012-Sender: halo1@HIDDEN
To: Dan Nicolaescu <dann@HIDDEN>, Richard Stallman <rms@HIDDEN>
Message-id: <83aa7xe0n9.fsf@HIDDEN>
References: <yxqwrbaadvp.fsf@HIDDEN> <83k47ailf0.fsf@HIDDEN>
	<yxqpqgzrym5.fsf@HIDDEN> <83zkg2fzgt.fsf@HIDDEN>
	<83vcqqfy5h.fsf@HIDDEN> <yxqy5vml8cc.fsf@HIDDEN>
	<83k475fsxp.fsf@HIDDEN> <yxqpqgte1xn.fsf@HIDDEN>
X-Spam-Score: -2.1 (--)
X-Debbugs-Envelope-To: 9990
Cc: 9990 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
Reply-To: Eli Zaretskii <eliz@HIDDEN>
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -2.1 (--)

> From: Dan Nicolaescu <dann@HIDDEN>
> Cc: 9990 <at> debbugs.gnu.org
> Date: Tue, 15 Nov 2011 12:21:56 -0500
> 
> BTW, why is the hash only using 28 bits instead of the full 32?  Won't
> it get a bit more precision if using 32?

I don't know.  I suspect this is simply history inherited from a
similar (but not identical -- why?) code in line_hash_code, which also
uses 28 bits.

Richard, do you remember by chance why only 28 bits are used?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#9990; Package emacs. Full text available.

Message received at 9990 <at> debbugs.gnu.org:


Received: (at 9990) by debbugs.gnu.org; 15 Nov 2011 17:47:45 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Nov 15 12:47:45 2011
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1RQN6m-0006Al-Hr
	for submit <at> debbugs.gnu.org; Tue, 15 Nov 2011 12:47:44 -0500
Received: from mtaout22.012.net.il ([80.179.55.172])
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <eliz@HIDDEN>) id 1RQN6j-0006A9-C8
	for 9990 <at> debbugs.gnu.org; Tue, 15 Nov 2011 12:47:42 -0500
Received: from conversion-daemon.a-mtaout22.012.net.il by
	a-mtaout22.012.net.il (HyperSendmail v2007.08) id
	<0LUP00L00QL2Z200@HIDDEN> for
	9990 <at> debbugs.gnu.org; Tue, 15 Nov 2011 19:46:39 +0200 (IST)
Received: from HOME-C4E4A596F7 ([77.124.184.15]) by a-mtaout22.012.net.il
	(HyperSendmail v2007.08) with ESMTPA id
	<0LUP00LHVQPQNG40@HIDDEN>;
	Tue, 15 Nov 2011 19:46:38 +0200 (IST)
Date: Tue, 15 Nov 2011 19:44:45 +0200
From: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#9990: valgrind warning in add_row_entry
In-reply-to: <yxq1ut91fw5.fsf@HIDDEN>
X-012-Sender: halo1@HIDDEN
To: Dan Nicolaescu <dann@HIDDEN>
Message-id: <83bosde0vm.fsf@HIDDEN>
References: <yxqwrbaadvp.fsf@HIDDEN> <83k47ailf0.fsf@HIDDEN>
	<yxqpqgzrym5.fsf@HIDDEN> <83zkg2fzgt.fsf@HIDDEN>
	<83vcqqfy5h.fsf@HIDDEN> <yxqy5vml8cc.fsf@HIDDEN>
	<83k475fsxp.fsf@HIDDEN> <yxq1ut91fw5.fsf@HIDDEN>
X-Spam-Score: -2.1 (--)
X-Debbugs-Envelope-To: 9990
Cc: 9990 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
Reply-To: Eli Zaretskii <eliz@HIDDEN>
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -2.1 (--)

> From: Dan Nicolaescu <dann@HIDDEN>
> Cc: 9990 <at> debbugs.gnu.org
> Date: Tue, 15 Nov 2011 11:58:50 -0500
> 
> > I added a function that verifies the hash value of glyph rows before
> > it is used in row_equal_p, and also in adjust_glyph_matrix, where the
> > offending reallocation takes place.  I cannot trigger the xasserts
> > that use this function when I use "C-h H".  Can you?
> 
> No, I cannot.
> 
> > If the hash values are always correct where they are used, I guess
> > that excludes the possibility that we use an uninitialized value,
> > right?
> 
> I even added an  xassert (verify_row_hash (row)) in add_row_entry, and
> it does not trigger.  Strange...

I have a feeling I didn't interpret the valgrind diagnostics
correctly.  But I don't see any alternative interpretation that would
make sense.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#9990; Package emacs. Full text available.

Message received at 9990 <at> debbugs.gnu.org:


Received: (at 9990) by debbugs.gnu.org; 15 Nov 2011 17:22:42 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Nov 15 12:22:42 2011
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1RQMiX-0004QR-2A
	for submit <at> debbugs.gnu.org; Tue, 15 Nov 2011 12:22:41 -0500
Received: from fencepost.gnu.org ([140.186.70.10] ident=Debian-exim)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <dann@HIDDEN>) id 1RQMiT-0004Q8-Uz
	for 9990 <at> debbugs.gnu.org; Tue, 15 Nov 2011 12:22:39 -0500
Received: from dann by fencepost.gnu.org with local (Exim 4.71)
	(envelope-from <dann@HIDDEN>)
	id 1RQMho-0001mf-Pl; Tue, 15 Nov 2011 12:21:56 -0500
From: Dan Nicolaescu <dann@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#9990: valgrind warning in add_row_entry
References: <yxqwrbaadvp.fsf@HIDDEN> <83k47ailf0.fsf@HIDDEN>
	<yxqpqgzrym5.fsf@HIDDEN> <83zkg2fzgt.fsf@HIDDEN>
	<83vcqqfy5h.fsf@HIDDEN> <yxqy5vml8cc.fsf@HIDDEN>
	<83k475fsxp.fsf@HIDDEN>
Date: Tue, 15 Nov 2011 12:21:56 -0500
In-Reply-To: <83k475fsxp.fsf@HIDDEN> (Eli Zaretskii's message of "Sat, 12 Nov
	2011 14:04:18 +0200")
Message-ID: <yxqpqgte1xn.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Spam-Score: -6.6 (------)
X-Debbugs-Envelope-To: 9990
Cc: 9990 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -6.6 (------)

Eli Zaretskii <eliz@HIDDEN> writes:

>> From: Dan Nicolaescu <dann@HIDDEN>
>> Cc: 9990 <at> debbugs.gnu.org
>> Date: Fri, 11 Nov 2011 15:20:19 -0500
>> 
>> I haven't seen the one in row_equal_p anymore (but that one was not easy
>> to reproduce), the ones in update_window still show up.
>
> I added a function that verifies the hash value of glyph rows before
> it is used in row_equal_p, and also in adjust_glyph_matrix, where the
> offending reallocation takes place.  I cannot trigger the xasserts
> that use this function when I use "C-h H".  Can you?

BTW, why is the hash only using 28 bits instead of the full 32?  Won't
it get a bit more precision if using 32?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#9990; Package emacs. Full text available.

Message received at 9990 <at> debbugs.gnu.org:


Received: (at 9990) by debbugs.gnu.org; 15 Nov 2011 16:59:34 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Nov 15 11:59:34 2011
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1RQMM9-0002o9-Gk
	for submit <at> debbugs.gnu.org; Tue, 15 Nov 2011 11:59:33 -0500
Received: from fencepost.gnu.org ([140.186.70.10] ident=Debian-exim)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <dann@HIDDEN>) id 1RQMM6-0002ns-S0
	for 9990 <at> debbugs.gnu.org; Tue, 15 Nov 2011 11:59:31 -0500
Received: from dann by fencepost.gnu.org with local (Exim 4.71)
	(envelope-from <dann@HIDDEN>)
	id 1RQMLS-0007lc-4H; Tue, 15 Nov 2011 11:58:50 -0500
From: Dan Nicolaescu <dann@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#9990: valgrind warning in add_row_entry
References: <yxqwrbaadvp.fsf@HIDDEN> <83k47ailf0.fsf@HIDDEN>
	<yxqpqgzrym5.fsf@HIDDEN> <83zkg2fzgt.fsf@HIDDEN>
	<83vcqqfy5h.fsf@HIDDEN> <yxqy5vml8cc.fsf@HIDDEN>
	<83k475fsxp.fsf@HIDDEN>
Date: Tue, 15 Nov 2011 11:58:50 -0500
In-Reply-To: <83k475fsxp.fsf@HIDDEN> (Eli Zaretskii's message of "Sat, 12 Nov
	2011 14:04:18 +0200")
Message-ID: <yxq1ut91fw5.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Spam-Score: -6.6 (------)
X-Debbugs-Envelope-To: 9990
Cc: 9990 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -6.6 (------)

Eli Zaretskii <eliz@HIDDEN> writes:

>> From: Dan Nicolaescu <dann@HIDDEN>
>> Cc: 9990 <at> debbugs.gnu.org
>> Date: Fri, 11 Nov 2011 15:20:19 -0500
>> 
>> I haven't seen the one in row_equal_p anymore (but that one was not easy
>> to reproduce), the ones in update_window still show up.
>
> I added a function that verifies the hash value of glyph rows before
> it is used in row_equal_p, and also in adjust_glyph_matrix, where the
> offending reallocation takes place.  I cannot trigger the xasserts
> that use this function when I use "C-h H".  Can you?

No, I cannot.

> If the hash values are always correct where they are used, I guess
> that excludes the possibility that we use an uninitialized value,
> right?

I even added an  xassert (verify_row_hash (row)) in add_row_entry, and
it does not trigger.  Strange...




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#9990; Package emacs. Full text available.

Message received at 9990 <at> debbugs.gnu.org:


Received: (at 9990) by debbugs.gnu.org; 12 Nov 2011 12:07:01 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Nov 12 07:07:01 2011
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1RPCMO-0002MN-0h
	for submit <at> debbugs.gnu.org; Sat, 12 Nov 2011 07:07:00 -0500
Received: from mtaout22.012.net.il ([80.179.55.172])
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <eliz@HIDDEN>) id 1RPCMK-0002Ln-IK
	for 9990 <at> debbugs.gnu.org; Sat, 12 Nov 2011 07:06:58 -0500
Received: from conversion-daemon.a-mtaout22.012.net.il by
	a-mtaout22.012.net.il (HyperSendmail v2007.08) id
	<0LUJ00G00Q18P300@HIDDEN> for
	9990 <at> debbugs.gnu.org; Sat, 12 Nov 2011 14:06:17 +0200 (IST)
Received: from HOME-C4E4A596F7 ([84.229.66.14]) by a-mtaout22.012.net.il
	(HyperSendmail v2007.08) with ESMTPA id
	<0LUJ00G1UQYESA00@HIDDEN>;
	Sat, 12 Nov 2011 14:06:17 +0200 (IST)
Date: Sat, 12 Nov 2011 14:04:18 +0200
From: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#9990: valgrind warning in add_row_entry
In-reply-to: <yxqy5vml8cc.fsf@HIDDEN>
X-012-Sender: halo1@HIDDEN
To: Dan Nicolaescu <dann@HIDDEN>
Message-id: <83k475fsxp.fsf@HIDDEN>
References: <yxqwrbaadvp.fsf@HIDDEN> <83k47ailf0.fsf@HIDDEN>
	<yxqpqgzrym5.fsf@HIDDEN> <83zkg2fzgt.fsf@HIDDEN>
	<83vcqqfy5h.fsf@HIDDEN> <yxqy5vml8cc.fsf@HIDDEN>
X-Spam-Score: -2.0 (--)
X-Debbugs-Envelope-To: 9990
Cc: 9990 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
Reply-To: Eli Zaretskii <eliz@HIDDEN>
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -2.0 (--)

> From: Dan Nicolaescu <dann@HIDDEN>
> Cc: 9990 <at> debbugs.gnu.org
> Date: Fri, 11 Nov 2011 15:20:19 -0500
> 
> I haven't seen the one in row_equal_p anymore (but that one was not easy
> to reproduce), the ones in update_window still show up.

I added a function that verifies the hash value of glyph rows before
it is used in row_equal_p, and also in adjust_glyph_matrix, where the
offending reallocation takes place.  I cannot trigger the xasserts
that use this function when I use "C-h H".  Can you?

If the hash values are always correct where they are used, I guess
that excludes the possibility that we use an uninitialized value,
right?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#9990; Package emacs. Full text available.

Message received at 9990 <at> debbugs.gnu.org:


Received: (at 9990) by debbugs.gnu.org; 11 Nov 2011 20:20:39 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Nov 11 15:20:39 2011
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ROxaZ-0006Bj-Ly
	for submit <at> debbugs.gnu.org; Fri, 11 Nov 2011 15:20:39 -0500
Received: from fencepost.gnu.org ([140.186.70.10] ident=Debian-exim)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <dann@HIDDEN>) id 1ROxaY-0006Bd-Dg
	for 9990 <at> debbugs.gnu.org; Fri, 11 Nov 2011 15:20:38 -0500
Received: from dann by fencepost.gnu.org with local (Exim 4.71)
	(envelope-from <dann@HIDDEN>)
	id 1ROxaF-0004z6-V5; Fri, 11 Nov 2011 15:20:19 -0500
From: Dan Nicolaescu <dann@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#9990: valgrind warning in add_row_entry
References: <yxqwrbaadvp.fsf@HIDDEN> <83k47ailf0.fsf@HIDDEN>
	<yxqpqgzrym5.fsf@HIDDEN> <83zkg2fzgt.fsf@HIDDEN>
	<83vcqqfy5h.fsf@HIDDEN>
Date: Fri, 11 Nov 2011 15:20:19 -0500
In-Reply-To: <83vcqqfy5h.fsf@HIDDEN> (Eli Zaretskii's message of "Fri, 11 Nov
	2011 17:59:22 +0200")
Message-ID: <yxqy5vml8cc.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Spam-Score: -6.6 (------)
X-Debbugs-Envelope-To: 9990
Cc: 9990 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -6.6 (------)

Eli Zaretskii <eliz@HIDDEN> writes:

>> Date: Fri, 11 Nov 2011 17:30:58 +0200
>> From: Eli Zaretskii <eliz@HIDDEN>
>> Cc: 9990 <at> debbugs.gnu.org
>> 
>> However, I spotted something strange related to the call to
>> row_equal_p, here:
>> 
>>   /* Skip over rows equal at the bottom.  */
>>   i = last_new;
>>   j = last_old;
>>   while (i - 1 > first_new
>>          && j - 1 > first_old
>>          && MATRIX_ROW (current_matrix, i - 1)->enabled_p
>> 	 && (MATRIX_ROW (current_matrix, i - 1)->y
>> 	     == MATRIX_ROW (desired_matrix, j - 1)->y)
>> 	 && !MATRIX_ROW (desired_matrix, j - 1)->redraw_fringe_bitmaps_p
>>          && row_equal_p (MATRIX_ROW (desired_matrix, i - 1),
>>                          MATRIX_ROW (current_matrix, j - 1), 1))
>>     --i, --j;
>> 
>> Some of these conditions use incorrect indices to access the glyph
>> matrices: `i' should be used for the current matrix and `j' for the
>> desired matrix.  Some of these conditions use `i' and `j' correctly,
>> some don't.
>
> Below is a patch I intend to install, if no one finds any thinko in
> it.  Dan, can you try this and see if it resolves the valgrind
> complaints (assuming you can reproduce them)?
>
> === modified file 'src/dispnew.c'
> --- src/dispnew.c	2011-10-08 10:58:50 +0000
> +++ src/dispnew.c	2011-11-11 15:53:27 +0000
> @@ -4334,10 +4334,10 @@ scrolling_window (struct window *w, int 
>    j = last_old;
>    while (i - 1 > first_new
>           && j - 1 > first_old
> -         && MATRIX_ROW (current_matrix, i - 1)->enabled_p
> -	 && (MATRIX_ROW (current_matrix, i - 1)->y
> -	     == MATRIX_ROW (desired_matrix, j - 1)->y)
> -	 && !MATRIX_ROW (desired_matrix, j - 1)->redraw_fringe_bitmaps_p
> +         && MATRIX_ROW (current_matrix, j - 1)->enabled_p
> +	 && (MATRIX_ROW (current_matrix, j - 1)->y
> +	     == MATRIX_ROW (desired_matrix, i - 1)->y)
> +	 && !MATRIX_ROW (desired_matrix, i - 1)->redraw_fringe_bitmaps_p
>           && row_equal_p (MATRIX_ROW (desired_matrix, i - 1),
>                           MATRIX_ROW (current_matrix, j - 1), 1))
>      --i, --j;

I haven't seen the one in row_equal_p anymore (but that one was not easy
to reproduce), the ones in update_window still show up.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#9990; Package emacs. Full text available.

Message received at 9990 <at> debbugs.gnu.org:


Received: (at 9990) by debbugs.gnu.org; 11 Nov 2011 20:17:55 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Nov 11 15:17:55 2011
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ROxXu-00067p-V3
	for submit <at> debbugs.gnu.org; Fri, 11 Nov 2011 15:17:55 -0500
Received: from fencepost.gnu.org ([140.186.70.10] ident=Debian-exim)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <dann@HIDDEN>) id 1ROxXs-00067i-Fi
	for 9990 <at> debbugs.gnu.org; Fri, 11 Nov 2011 15:17:53 -0500
Received: from dann by fencepost.gnu.org with local (Exim 4.71)
	(envelope-from <dann@HIDDEN>)
	id 1ROxXa-0004mz-5Y; Fri, 11 Nov 2011 15:17:34 -0500
From: Dan Nicolaescu <dann@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#9990: valgrind warning in add_row_entry
References: <yxqwrbaadvp.fsf@HIDDEN> <83k47ailf0.fsf@HIDDEN>
	<yxqpqgzrym5.fsf@HIDDEN> <83zkg2fzgt.fsf@HIDDEN>
Date: Fri, 11 Nov 2011 15:17:34 -0500
In-Reply-To: <83zkg2fzgt.fsf@HIDDEN> (Eli Zaretskii's message of "Fri, 11 Nov
	2011 17:30:58 +0200")
Message-ID: <yxq39dumn1d.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Spam-Score: -6.6 (------)
X-Debbugs-Envelope-To: 9990
Cc: 9990 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -6.6 (------)

Eli Zaretskii <eliz@HIDDEN> writes:

>> From: Dan Nicolaescu <dann@HIDDEN>
>> Cc: 9990 <at> debbugs.gnu.org
>> Date: Fri, 11 Nov 2011 00:56:18 -0500
>> 
>> I got another (maybe) similar one.  For this one I had the option that
>> shows the location of uninitialized variable.  This happened after doing C-h H.
>
> Is this reproducible?  If so, can you tell how to reproduce it?

valgrind ./temacs -Q
C-h H




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#9990; Package emacs. Full text available.

Message received at 9990 <at> debbugs.gnu.org:


Received: (at 9990) by debbugs.gnu.org; 11 Nov 2011 16:03:13 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Nov 11 11:03:13 2011
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ROtZR-0006Rn-28
	for submit <at> debbugs.gnu.org; Fri, 11 Nov 2011 11:03:13 -0500
Received: from mtaout20.012.net.il ([80.179.55.166])
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <eliz@HIDDEN>) id 1ROtZO-0006Rb-KI
	for 9990 <at> debbugs.gnu.org; Fri, 11 Nov 2011 11:03:12 -0500
Received: from conversion-daemon.a-mtaout20.012.net.il by
	a-mtaout20.012.net.il (HyperSendmail v2007.08) id
	<0LUI008006Z7DS00@HIDDEN> for
	9990 <at> debbugs.gnu.org; Fri, 11 Nov 2011 18:01:23 +0200 (IST)
Received: from HOME-C4E4A596F7 ([77.126.231.130]) by a-mtaout20.012.net.il
	(HyperSendmail v2007.08) with ESMTPA id
	<0LUI007M1766R790@HIDDEN>;
	Fri, 11 Nov 2011 18:01:19 +0200 (IST)
Date: Fri, 11 Nov 2011 17:59:22 +0200
From: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#9990: valgrind warning in add_row_entry
In-reply-to: <83zkg2fzgt.fsf@HIDDEN>
X-012-Sender: halo1@HIDDEN
To: dann@HIDDEN
Message-id: <83vcqqfy5h.fsf@HIDDEN>
References: <yxqwrbaadvp.fsf@HIDDEN> <83k47ailf0.fsf@HIDDEN>
	<yxqpqgzrym5.fsf@HIDDEN> <83zkg2fzgt.fsf@HIDDEN>
X-Spam-Score: -2.1 (--)
X-Debbugs-Envelope-To: 9990
Cc: 9990 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
Reply-To: Eli Zaretskii <eliz@HIDDEN>
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -2.1 (--)

> Date: Fri, 11 Nov 2011 17:30:58 +0200
> From: Eli Zaretskii <eliz@HIDDEN>
> Cc: 9990 <at> debbugs.gnu.org
> 
> However, I spotted something strange related to the call to
> row_equal_p, here:
> 
>   /* Skip over rows equal at the bottom.  */
>   i = last_new;
>   j = last_old;
>   while (i - 1 > first_new
>          && j - 1 > first_old
>          && MATRIX_ROW (current_matrix, i - 1)->enabled_p
> 	 && (MATRIX_ROW (current_matrix, i - 1)->y
> 	     == MATRIX_ROW (desired_matrix, j - 1)->y)
> 	 && !MATRIX_ROW (desired_matrix, j - 1)->redraw_fringe_bitmaps_p
>          && row_equal_p (MATRIX_ROW (desired_matrix, i - 1),
>                          MATRIX_ROW (current_matrix, j - 1), 1))
>     --i, --j;
> 
> Some of these conditions use incorrect indices to access the glyph
> matrices: `i' should be used for the current matrix and `j' for the
> desired matrix.  Some of these conditions use `i' and `j' correctly,
> some don't.

Below is a patch I intend to install, if no one finds any thinko in
it.  Dan, can you try this and see if it resolves the valgrind
complaints (assuming you can reproduce them)?

=== modified file 'src/dispnew.c'
--- src/dispnew.c	2011-10-08 10:58:50 +0000
+++ src/dispnew.c	2011-11-11 15:53:27 +0000
@@ -4334,10 +4334,10 @@ scrolling_window (struct window *w, int 
   j = last_old;
   while (i - 1 > first_new
          && j - 1 > first_old
-         && MATRIX_ROW (current_matrix, i - 1)->enabled_p
-	 && (MATRIX_ROW (current_matrix, i - 1)->y
-	     == MATRIX_ROW (desired_matrix, j - 1)->y)
-	 && !MATRIX_ROW (desired_matrix, j - 1)->redraw_fringe_bitmaps_p
+         && MATRIX_ROW (current_matrix, j - 1)->enabled_p
+	 && (MATRIX_ROW (current_matrix, j - 1)->y
+	     == MATRIX_ROW (desired_matrix, i - 1)->y)
+	 && !MATRIX_ROW (desired_matrix, i - 1)->redraw_fringe_bitmaps_p
          && row_equal_p (MATRIX_ROW (desired_matrix, i - 1),
                          MATRIX_ROW (current_matrix, j - 1), 1))
     --i, --j;





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#9990; Package emacs. Full text available.

Message received at 9990 <at> debbugs.gnu.org:


Received: (at 9990) by debbugs.gnu.org; 11 Nov 2011 15:33:22 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Nov 11 10:33:21 2011
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ROt6X-0005km-JZ
	for submit <at> debbugs.gnu.org; Fri, 11 Nov 2011 10:33:21 -0500
Received: from mtaout22.012.net.il ([80.179.55.172])
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <eliz@HIDDEN>) id 1ROt6U-0005kZ-96
	for 9990 <at> debbugs.gnu.org; Fri, 11 Nov 2011 10:33:19 -0500
Received: from conversion-daemon.a-mtaout22.012.net.il by
	a-mtaout22.012.net.il (HyperSendmail v2007.08) id
	<0LUI005005RJSU00@HIDDEN> for
	9990 <at> debbugs.gnu.org; Fri, 11 Nov 2011 17:32:55 +0200 (IST)
Received: from HOME-C4E4A596F7 ([77.126.231.130]) by a-mtaout22.012.net.il
	(HyperSendmail v2007.08) with ESMTPA id
	<0LUI005WI5UUJC60@HIDDEN>;
	Fri, 11 Nov 2011 17:32:55 +0200 (IST)
Date: Fri, 11 Nov 2011 17:30:58 +0200
From: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#9990: valgrind warning in add_row_entry
In-reply-to: <yxqpqgzrym5.fsf@HIDDEN>
X-012-Sender: halo1@HIDDEN
To: Dan Nicolaescu <dann@HIDDEN>
Message-id: <83zkg2fzgt.fsf@HIDDEN>
References: <yxqwrbaadvp.fsf@HIDDEN> <83k47ailf0.fsf@HIDDEN>
	<yxqpqgzrym5.fsf@HIDDEN>
X-Spam-Score: -2.1 (--)
X-Debbugs-Envelope-To: 9990
Cc: 9990 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
Reply-To: Eli Zaretskii <eliz@HIDDEN>
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -2.1 (--)

> From: Dan Nicolaescu <dann@HIDDEN>
> Cc: 9990 <at> debbugs.gnu.org
> Date: Fri, 11 Nov 2011 00:56:18 -0500
> 
> I got another (maybe) similar one.  For this one I had the option that
> shows the location of uninitialized variable.  This happened after doing C-h H.

Is this reproducible?  If so, can you tell how to reproduce it?

> ==4752== Conditional jump or move depends on uninitialised value(s)
> ==4752==    at 0x4137ED: update_window (dispnew.c:1276)
> ==4752==    by 0x414F02: update_window_tree (dispnew.c:3326)
> ==4752==    by 0x4181CD: update_frame (dispnew.c:3253)
> ==4752==    by 0x440E7B: redisplay_internal (xdisp.c:13175)
> ==4752==    by 0x4F0A87: read_char (keyboard.c:2443)
> ==4752==    by 0x4F2F46: read_key_sequence.constprop.14 (keyboard.c:9290)
> ==4752==    by 0x4F4C14: command_loop_1 (keyboard.c:1447)
> ==4752==    by 0x559B55: internal_condition_case (eval.c:1499)
> ==4752==    by 0x4E7FED: command_loop_2 (keyboard.c:1158)
> ==4752==    by 0x559A37: internal_catch (eval.c:1256)
> ==4752==    by 0x4E94EE: recursive_edit_1 (keyboard.c:1123)
> ==4752==    by 0x515CFB: read_minibuf (minibuf.c:677)
> ==4752==  Uninitialised value was created by a heap allocation
> ==4752==    at 0x4A0649D: malloc (vg_replace_malloc.c:236)
> ==4752==    by 0x5407CF: xrealloc (alloc.c:742)
> ==4752==    by 0x411001: adjust_glyph_matrix (dispnew.c:580)
> ==4752==    by 0x41148C: allocate_matrices_for_window_redisplay (dispnew.c:1838)
> ==4752==    by 0x4119DC: adjust_frame_glyphs (dispnew.c:2167)
> ==4752==    by 0x416BC9: adjust_glyphs (dispnew.c:1860)
> ==4752==    by 0x4686A7: Fdelete_other_windows_internal (window.c:2809)
> ==4752==    by 0x55B9FB: Ffuncall (eval.c:2977)
> ==4752==    by 0x593BE5: exec_byte_code (bytecode.c:785)
> ==4752==    by 0x55AE2A: eval_sub (eval.c:2328)
> ==4752==    by 0x559A37: internal_catch (eval.c:1256)
> ==4752==    by 0x594567: exec_byte_code (bytecode.c:966)

It seems to tell that some glyph row(s) whose glyphs are reallocated
here:

	  while (row < end)
	    {
	      row->glyphs[LEFT_MARGIN_AREA]
		= xnrealloc (row->glyphs[LEFT_MARGIN_AREA],  <<<<<<<<<<<
			     dim.width, sizeof (struct glyph));

don't have their hash values initialized, and so this comparison
within row_equal_p:

  if (a == b)
    return 1;
  else if (a->hash != b->hash)  <<<<<<<<<<<<<<<<<<<<<
    return 0;
  else
    {

uses uninitialized value.

The strange thing is, the above xnrealloc is not supposed to affect
the row's hash value in any way, it just reallocates its glyphs.  So I
cannot make heads or tails out of this.  And the hash value is
initialized to zero for additional glyph rows added to a glyph matrix,
in this fragment:

  /* Enlarge MATRIX->rows if necessary.  New rows are cleared.  */
  if (matrix->rows_allocated < dim.height)
    {
      int old_alloc = matrix->rows_allocated;
      new_rows = dim.height - matrix->rows_allocated;
      matrix->rows = xpalloc (matrix->rows, &matrix->rows_allocated,
			      new_rows, INT_MAX, sizeof *matrix->rows);
      memset (matrix->rows + old_alloc, 0,
	      (matrix->rows_allocated - old_alloc) * sizeof *matrix->rows);
    }

The call to `memset' should zero out all the fields of each glyph_row
that were just added to enlarge the matrix.

However, I spotted something strange related to the call to
row_equal_p, here:

  /* Skip over rows equal at the bottom.  */
  i = last_new;
  j = last_old;
  while (i - 1 > first_new
         && j - 1 > first_old
         && MATRIX_ROW (current_matrix, i - 1)->enabled_p
	 && (MATRIX_ROW (current_matrix, i - 1)->y
	     == MATRIX_ROW (desired_matrix, j - 1)->y)
	 && !MATRIX_ROW (desired_matrix, j - 1)->redraw_fringe_bitmaps_p
         && row_equal_p (MATRIX_ROW (desired_matrix, i - 1),
                         MATRIX_ROW (current_matrix, j - 1), 1))
    --i, --j;

Some of these conditions use incorrect indices to access the glyph
matrices: `i' should be used for the current matrix and `j' for the
desired matrix.  Some of these conditions use `i' and `j' correctly,
some don't.  So it's possible, for example, that the test of the
enabled_p flag produces incorrect results, and we then proceed calling
row_equal_p on a row which is not enabled and whose hash was not
computed by redisplay.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#9990; Package emacs. Full text available.

Message received at 9990 <at> debbugs.gnu.org:


Received: (at 9990) by debbugs.gnu.org; 11 Nov 2011 05:56:36 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Nov 11 00:56:36 2011
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ROk6O-0000Az-HO
	for submit <at> debbugs.gnu.org; Fri, 11 Nov 2011 00:56:36 -0500
Received: from fencepost.gnu.org ([140.186.70.10] ident=Debian-exim)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <dann@HIDDEN>) id 1ROk6L-0000Ap-OI
	for 9990 <at> debbugs.gnu.org; Fri, 11 Nov 2011 00:56:34 -0500
Received: from dann by fencepost.gnu.org with local (Exim 4.71)
	(envelope-from <dann@HIDDEN>)
	id 1ROk66-0004ba-CL; Fri, 11 Nov 2011 00:56:18 -0500
From: Dan Nicolaescu <dann@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#9990: valgrind warning in add_row_entry
References: <yxqwrbaadvp.fsf@HIDDEN> <83k47ailf0.fsf@HIDDEN>
Date: Fri, 11 Nov 2011 00:56:18 -0500
In-Reply-To: <83k47ailf0.fsf@HIDDEN> (Eli Zaretskii's message of "Tue, 08 Nov
	2011 19:17:07 +0200")
Message-ID: <yxqpqgzrym5.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Spam-Score: -6.6 (------)
X-Debbugs-Envelope-To: 9990
Cc: 9990 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -6.6 (------)

Eli Zaretskii <eliz@HIDDEN> writes:

>> From: Dan Nicolaescu <dann@HIDDEN>
>> Date: Tue, 08 Nov 2011 09:27:06 -0500
>> 
>> 
>> valgrind ./temacs -Q gets this warning:
>> 
>> ==7487== Use of uninitialised value of size 8
>> ==7487==    at 0x4140F4: update_window (dispnew.c:4212)
>> ==7487==    by 0x414F32: update_window_tree (dispnew.c:3326)
>> ==7487==    by 0x414F0E: update_window_tree (dispnew.c:3324)
>> ==7487==    by 0x4181FD: update_frame (dispnew.c:3253)
>> ==7487==    by 0x443EDB: redisplay_internal (xdisp.c:13175)
>> ==7487==    by 0x4F6F47: read_char (keyboard.c:2443)
>> ==7487==    by 0x4F9406: read_key_sequence.constprop.14 (keyboard.c:9290)
>> ==7487==    by 0x4FB0D4: command_loop_1 (keyboard.c:1447)
>> ==7487==    by 0x560015: internal_condition_case (eval.c:1499)
>> ==7487==    by 0x4EE4AD: command_loop_2 (keyboard.c:1158)
>> ==7487==    by 0x55FEF7: internal_catch (eval.c:1256)
>> ==7487==    by 0x4EFA36: recursive_edit_1 (keyboard.c:1137)
>> ==7487== 
>> ==7487== 
>> ==7487== ---- Attach to debugger ? --- [Return/N/n/Y/y/C/c] ---- Y
>> 
>> The line in question is:
>> 
>> 4212      entry = row_table[i];
>> 
>> 
>> (gdb) p i
>> $1 = 0x157
>> (gdb) p row_table[i]
>> $2 = (struct row_entry *) 0x0
>> (gdb) p row_table_size
>> $3 = 0x193
>> 
>> Is it possible for the contents of row_table to be uninitialized?  Is this warning a false positive?
>
> row_table and row_table_size are static variables.  So at least in
> temacs they should be initialized to zero, by this code in
> scrolling_window:


>
>   n = desired_matrix->nrows;
>   n += current_matrix->nrows;
>   if (row_table_size < 3 * n)
>     {
>       ptrdiff_t size = next_almost_prime (3 * n);
>       row_table = xnrealloc (row_table, size, sizeof *row_table);
>       row_table_size = size;
>       memset (row_table, 0, size * sizeof *row_table);
>     }
>
> Because row_table_size is initially zero, the first call to
> scrolling_window will allocate row_table[] and zero it out.
>
> The only call to add_row_entry, the function where line 4212 belongs,
> is in the same scrolling_window, a few lines _below_ the above
> fragment that allocates and zeroes out row_table[].
>
> So I don't see how row_table[i] could be uninitialized for any i that
> is less than row_table_size.
>
> Does valgrind know that row_table_size is initially zero because it is
> static?

I think it should.

I got another (maybe) similar one.  For this one I had the option that
shows the location of uninitialized variable.  This happened after doing C-h H.

==4752== Conditional jump or move depends on uninitialised value(s)
==4752==    at 0x4137ED: update_window (dispnew.c:1276)
==4752==    by 0x414F02: update_window_tree (dispnew.c:3326)
==4752==    by 0x4181CD: update_frame (dispnew.c:3253)
==4752==    by 0x440E7B: redisplay_internal (xdisp.c:13175)
==4752==    by 0x4F0A87: read_char (keyboard.c:2443)
==4752==    by 0x4F2F46: read_key_sequence.constprop.14 (keyboard.c:9290)
==4752==    by 0x4F4C14: command_loop_1 (keyboard.c:1447)
==4752==    by 0x559B55: internal_condition_case (eval.c:1499)
==4752==    by 0x4E7FED: command_loop_2 (keyboard.c:1158)
==4752==    by 0x559A37: internal_catch (eval.c:1256)
==4752==    by 0x4E94EE: recursive_edit_1 (keyboard.c:1123)
==4752==    by 0x515CFB: read_minibuf (minibuf.c:677)
==4752==  Uninitialised value was created by a heap allocation
==4752==    at 0x4A0649D: malloc (vg_replace_malloc.c:236)
==4752==    by 0x5407CF: xrealloc (alloc.c:742)
==4752==    by 0x411001: adjust_glyph_matrix (dispnew.c:580)
==4752==    by 0x41148C: allocate_matrices_for_window_redisplay (dispnew.c:1838)
==4752==    by 0x4119DC: adjust_frame_glyphs (dispnew.c:2167)
==4752==    by 0x416BC9: adjust_glyphs (dispnew.c:1860)
==4752==    by 0x4686A7: Fdelete_other_windows_internal (window.c:2809)
==4752==    by 0x55B9FB: Ffuncall (eval.c:2977)
==4752==    by 0x593BE5: exec_byte_code (bytecode.c:785)
==4752==    by 0x55AE2A: eval_sub (eval.c:2328)
==4752==    by 0x559A37: internal_catch (eval.c:1256)
==4752==    by 0x594567: exec_byte_code (bytecode.c:966)
==4752== 


> and see what are the values of first_old, last_old, first_new, and
> last_new here, and whether the corresponding glyph rows look
> reasonable, including their hash values?  Or maybe just look at the
> row passed to add_row_entry.  You can display a given glyph_row
> structure with the pgrowx command in GDB (but it won't show the hash
> value, only how the row will look on the screen).  Another command is
> prowx.

I will do this when it happens again.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#9990; Package emacs. Full text available.

Message received at 9990 <at> debbugs.gnu.org:


Received: (at 9990) by debbugs.gnu.org; 8 Nov 2011 20:38:47 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Nov 08 15:38:47 2011
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1RNsRT-0005nQ-7r
	for submit <at> debbugs.gnu.org; Tue, 08 Nov 2011 15:38:47 -0500
Received: from mtaout20.012.net.il ([80.179.55.166])
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <eliz@HIDDEN>) id 1RNsRR-0005nB-0F
	for 9990 <at> debbugs.gnu.org; Tue, 08 Nov 2011 15:38:46 -0500
Received: from conversion-daemon.a-mtaout20.012.net.il by
	a-mtaout20.012.net.il (HyperSendmail v2007.08) id
	<0LUC00A00ZWVQH00@HIDDEN> for
	9990 <at> debbugs.gnu.org; Tue, 08 Nov 2011 22:37:55 +0200 (IST)
Received: from HOME-C4E4A596F7 ([84.228.42.212]) by a-mtaout20.012.net.il
	(HyperSendmail v2007.08) with ESMTPA id
	<0LUC0072SZZ6Z711@HIDDEN>;
	Tue, 08 Nov 2011 22:37:55 +0200 (IST)
Date: Tue, 08 Nov 2011 22:35:54 +0200
From: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#9990: valgrind warning in add_row_entry
In-reply-to: <m2ty6eo3n7.fsf@HIDDEN>
X-012-Sender: halo1@HIDDEN
To: Andreas Schwab <schwab@HIDDEN>
Message-id: <83ty6egxn9.fsf@HIDDEN>
References: <yxqwrbaadvp.fsf@HIDDEN> <83k47ailf0.fsf@HIDDEN>
	<m2ty6eo3n7.fsf@HIDDEN>
X-Spam-Score: -2.0 (--)
X-Debbugs-Envelope-To: 9990
Cc: dann@HIDDEN, 9990 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
Reply-To: Eli Zaretskii <eliz@HIDDEN>
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -2.0 (--)

> From: Andreas Schwab <schwab@HIDDEN>
> Cc: Dan Nicolaescu <dann@HIDDEN>,  9990 <at> debbugs.gnu.org
> Date: Tue, 08 Nov 2011 19:44:28 +0100
> 
> Eli Zaretskii <eliz@HIDDEN> writes:
> 
> > Does valgrind know that row_table_size is initially zero because it is
> > static?
> 
> valgrind does not know anything about variables, only about memory
> locations.  It operates at the machine language level.

Does that mean valgrind can potentially flag as uninitialized every
static variable that isn't explicitly initialized at run time?
Because AFAIK static variables are initialized by the linker (is that
right?).




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#9990; Package emacs. Full text available.

Message received at 9990 <at> debbugs.gnu.org:


Received: (at 9990) by debbugs.gnu.org; 8 Nov 2011 18:44:33 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Nov 08 13:44:33 2011
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1RNqev-0002KJ-4d
	for submit <at> debbugs.gnu.org; Tue, 08 Nov 2011 13:44:33 -0500
Received: from mail-out.m-online.net ([212.18.0.10])
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <whitebox@HIDDEN>) id 1RNqet-0002KC-AU
	for 9990 <at> debbugs.gnu.org; Tue, 08 Nov 2011 13:44:32 -0500
Received: from frontend1.mail.m-online.net (frontend1.mail.intern.m-online.net
	[192.168.8.180])
	by mail-out.m-online.net (Postfix) with ESMTP id 2ADA7188B5A0;
	Tue,  8 Nov 2011 19:46:09 +0100 (CET)
Received: from localhost (dynscan1.mnet-online.de [192.168.8.164])
	by mail.m-online.net (Postfix) with ESMTP id 1671A1C00054;
	Tue,  8 Nov 2011 19:44:30 +0100 (CET)
X-Virus-Scanned: amavisd-new at mnet-online.de
Received: from mail.mnet-online.de ([192.168.8.180])
	by localhost (dynscan1.mail.m-online.net [192.168.8.164]) (amavisd-new,
	port 10024)
	with ESMTP id VHw2st0HBaj0; Tue,  8 Nov 2011 19:44:28 +0100 (CET)
Received: from igel.home (ppp-88-217-115-129.dynamic.mnet-online.de
	[88.217.115.129]) by mail.mnet-online.de (Postfix) with ESMTP;
	Tue,  8 Nov 2011 19:44:28 +0100 (CET)
Received: by igel.home (Postfix, from userid 501)
	id 5BFBFCA29C; Tue,  8 Nov 2011 19:44:28 +0100 (CET)
From: Andreas Schwab <schwab@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#9990: valgrind warning in add_row_entry
References: <yxqwrbaadvp.fsf@HIDDEN> <83k47ailf0.fsf@HIDDEN>
X-Yow: Uh-oh!!  I'm having TOO MUCH FUN!!
Date: Tue, 08 Nov 2011 19:44:28 +0100
In-Reply-To: <83k47ailf0.fsf@HIDDEN> (Eli Zaretskii's message of "Tue, 08 Nov
	2011 19:17:07 +0200")
Message-ID: <m2ty6eo3n7.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.91 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.6 (--)
X-Debbugs-Envelope-To: 9990
Cc: Dan Nicolaescu <dann@HIDDEN>, 9990 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -2.6 (--)

Eli Zaretskii <eliz@HIDDEN> writes:

> Does valgrind know that row_table_size is initially zero because it is
> static?

valgrind does not know anything about variables, only about memory
locations.  It operates at the machine language level.

Andreas.

-- 
Andreas Schwab, schwab@HIDDEN
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#9990; Package emacs. Full text available.

Message received at 9990 <at> debbugs.gnu.org:


Received: (at 9990) by debbugs.gnu.org; 8 Nov 2011 17:24:56 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Nov 08 12:24:56 2011
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1RNpPr-0000Pu-F2
	for submit <at> debbugs.gnu.org; Tue, 08 Nov 2011 12:24:55 -0500
Received: from mtaout22.012.net.il ([80.179.55.172])
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <eliz@HIDDEN>) id 1RNpPn-0000PW-GV
	for 9990 <at> debbugs.gnu.org; Tue, 08 Nov 2011 12:24:53 -0500
Received: from conversion-daemon.a-mtaout22.012.net.il by
	a-mtaout22.012.net.il (HyperSendmail v2007.08) id
	<0LUC00500QIZZM00@HIDDEN> for
	9990 <at> debbugs.gnu.org; Tue, 08 Nov 2011 19:19:09 +0200 (IST)
Received: from HOME-C4E4A596F7 ([84.228.42.212]) by a-mtaout22.012.net.il
	(HyperSendmail v2007.08) with ESMTPA id
	<0LUC0039AQRVJST0@HIDDEN>;
	Tue, 08 Nov 2011 19:19:09 +0200 (IST)
Date: Tue, 08 Nov 2011 19:17:07 +0200
From: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#9990: valgrind warning in add_row_entry
In-reply-to: <yxqwrbaadvp.fsf@HIDDEN>
X-012-Sender: halo1@HIDDEN
To: Dan Nicolaescu <dann@HIDDEN>
Message-id: <83k47ailf0.fsf@HIDDEN>
References: <yxqwrbaadvp.fsf@HIDDEN>
X-Spam-Score: -2.0 (--)
X-Debbugs-Envelope-To: 9990
Cc: 9990 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
Reply-To: Eli Zaretskii <eliz@HIDDEN>
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -2.0 (--)

> From: Dan Nicolaescu <dann@HIDDEN>
> Date: Tue, 08 Nov 2011 09:27:06 -0500
> 
> 
> valgrind ./temacs -Q gets this warning:
> 
> ==7487== Use of uninitialised value of size 8
> ==7487==    at 0x4140F4: update_window (dispnew.c:4212)
> ==7487==    by 0x414F32: update_window_tree (dispnew.c:3326)
> ==7487==    by 0x414F0E: update_window_tree (dispnew.c:3324)
> ==7487==    by 0x4181FD: update_frame (dispnew.c:3253)
> ==7487==    by 0x443EDB: redisplay_internal (xdisp.c:13175)
> ==7487==    by 0x4F6F47: read_char (keyboard.c:2443)
> ==7487==    by 0x4F9406: read_key_sequence.constprop.14 (keyboard.c:9290)
> ==7487==    by 0x4FB0D4: command_loop_1 (keyboard.c:1447)
> ==7487==    by 0x560015: internal_condition_case (eval.c:1499)
> ==7487==    by 0x4EE4AD: command_loop_2 (keyboard.c:1158)
> ==7487==    by 0x55FEF7: internal_catch (eval.c:1256)
> ==7487==    by 0x4EFA36: recursive_edit_1 (keyboard.c:1137)
> ==7487== 
> ==7487== 
> ==7487== ---- Attach to debugger ? --- [Return/N/n/Y/y/C/c] ---- Y
> 
> The line in question is:
> 
> 4212      entry = row_table[i];
> 
> 
> (gdb) p i
> $1 = 0x157
> (gdb) p row_table[i]
> $2 = (struct row_entry *) 0x0
> (gdb) p row_table_size
> $3 = 0x193
> 
> Is it possible for the contents of row_table to be uninitialized?  Is this warning a false positive?

row_table and row_table_size are static variables.  So at least in
temacs they should be initialized to zero, by this code in
scrolling_window:

  n = desired_matrix->nrows;
  n += current_matrix->nrows;
  if (row_table_size < 3 * n)
    {
      ptrdiff_t size = next_almost_prime (3 * n);
      row_table = xnrealloc (row_table, size, sizeof *row_table);
      row_table_size = size;
      memset (row_table, 0, size * sizeof *row_table);
    }

Because row_table_size is initially zero, the first call to
scrolling_window will allocate row_table[] and zero it out.

The only call to add_row_entry, the function where line 4212 belongs,
is in the same scrolling_window, a few lines _below_ the above
fragment that allocates and zeroes out row_table[].

So I don't see how row_table[i] could be uninitialized for any i that
is less than row_table_size.

Does valgrind know that row_table_size is initially zero because it is
static?

The other possibility I see is that one or both of
w->current_matrix->nrows and w->desired_matrix->nrows are
uninitialized.  But I think if that were so, Emacs would crash and
burn trying to display such a window.

Yet another possibility is that the argument ROW passed to
add_row_entry is not initialized.  Then row->hash is a random value
and i inside add_row_entry is also a random value.  Can you look at
these two loops inside scrolling_window:

  /* Add rows from the current and desired matrix to the hash table
     row_hash_table to be able to find equal ones quickly.  */

  for (i = first_old; i < last_old; ++i)
    {
      if (MATRIX_ROW (current_matrix, i)->enabled_p)
	{
	  entry = add_row_entry (MATRIX_ROW (current_matrix, i));
	  old_lines[i] = entry;
	  ++entry->old_uses;
	}
      else
	old_lines[i] = NULL;
    }

  for (i = first_new; i < last_new; ++i)
    {
      xassert (MATRIX_ROW_ENABLED_P (desired_matrix, i));
      entry = add_row_entry (MATRIX_ROW (desired_matrix, i));
      ++entry->new_uses;
      entry->new_line_number = i;
      new_lines[i] = entry;
    }

and see what are the values of first_old, last_old, first_new, and
last_new here, and whether the corresponding glyph rows look
reasonable, including their hash values?  Or maybe just look at the
row passed to add_row_entry.  You can display a given glyph_row
structure with the pgrowx command in GDB (but it won't show the hash
value, only how the row will look on the screen).  Another command is
prowx.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#9990; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 8 Nov 2011 14:30:29 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Nov 08 09:30:29 2011
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1RNmh2-0002LI-77
	for submit <at> debbugs.gnu.org; Tue, 08 Nov 2011 09:30:29 -0500
Received: from eggs.gnu.org ([140.186.70.92])
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <dann@HIDDEN>) id 1RNmgx-0002L8-Ir
	for submit <at> debbugs.gnu.org; Tue, 08 Nov 2011 09:30:24 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <dann@HIDDEN>) id 1RNmdx-0004JT-Hp
	for submit <at> debbugs.gnu.org; Tue, 08 Nov 2011 09:27:25 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-4.1 required=5.0 tests=ALL_TRUSTED,BAYES_00,
	RP_MATCHES_RCVD autolearn=unavailable version=3.3.1
Received: from lists.gnu.org ([140.186.70.17]:55159)
	by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <dann@HIDDEN>)
	id 1RNmdx-0004JP-FK
	for submit <at> debbugs.gnu.org; Tue, 08 Nov 2011 09:27:17 -0500
Received: from eggs.gnu.org ([140.186.70.92]:40954)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <dann@HIDDEN>) id 1RNmdw-0006NJ-KH
	for bug-gnu-emacs@HIDDEN; Tue, 08 Nov 2011 09:27:17 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <dann@HIDDEN>) id 1RNmdn-0004IO-63
	for bug-gnu-emacs@HIDDEN; Tue, 08 Nov 2011 09:27:16 -0500
Received: from fencepost.gnu.org ([140.186.70.10]:56506)
	by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <dann@HIDDEN>)
	id 1RNmdn-0004ID-2Z
	for bug-gnu-emacs@HIDDEN; Tue, 08 Nov 2011 09:27:07 -0500
Received: from dann by fencepost.gnu.org with local (Exim 4.71)
	(envelope-from <dann@HIDDEN>) id 1RNmdm-0003al-Hf
	for bug-gnu-emacs@HIDDEN; Tue, 08 Nov 2011 09:27:06 -0500
From: Dan Nicolaescu <dann@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: valgrind warning in add_row_entry
Date: Tue, 08 Nov 2011 09:27:06 -0500
Message-ID: <yxqwrbaadvp.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
X-Received-From: 140.186.70.17
X-Spam-Score: -6.6 (------)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -6.6 (------)


valgrind ./temacs -Q gets this warning:

==7487== Use of uninitialised value of size 8
==7487==    at 0x4140F4: update_window (dispnew.c:4212)
==7487==    by 0x414F32: update_window_tree (dispnew.c:3326)
==7487==    by 0x414F0E: update_window_tree (dispnew.c:3324)
==7487==    by 0x4181FD: update_frame (dispnew.c:3253)
==7487==    by 0x443EDB: redisplay_internal (xdisp.c:13175)
==7487==    by 0x4F6F47: read_char (keyboard.c:2443)
==7487==    by 0x4F9406: read_key_sequence.constprop.14 (keyboard.c:9290)
==7487==    by 0x4FB0D4: command_loop_1 (keyboard.c:1447)
==7487==    by 0x560015: internal_condition_case (eval.c:1499)
==7487==    by 0x4EE4AD: command_loop_2 (keyboard.c:1158)
==7487==    by 0x55FEF7: internal_catch (eval.c:1256)
==7487==    by 0x4EFA36: recursive_edit_1 (keyboard.c:1137)
==7487== 
==7487== 
==7487== ---- Attach to debugger ? --- [Return/N/n/Y/y/C/c] ---- Y

The line in question is:

4212      entry = row_table[i];


(gdb) p i
$1 = 0x157
(gdb) p row_table[i]
$2 = (struct row_entry *) 0x0
(gdb) p row_table_size
$3 = 0x193

Is it possible for the contents of row_table to be uninitialized?  Is this warning a false positive?




Acknowledgement sent to Dan Nicolaescu <dann@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#9990; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Fri, 31 Oct 2014 17:00:04 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.