emacs-devel
[Top][All Lists]
Advanced

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

Re: valgrind warnings [Re: Emacs bzr memory footprint]


From: Dan Nicolaescu
Subject: Re: valgrind warnings [Re: Emacs bzr memory footprint]
Date: Fri, 28 Oct 2011 12:34:07 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux)

Eli Zaretskii <address@hidden> writes:

>> From: Dan Nicolaescu <address@hidden>
>> Cc: "Stephen J. Turnbull" <address@hidden>,  address@hidden
>> Date: Fri, 28 Oct 2011 10:38:03 -0400
>> 
>> > Valgrind produces these warnings, maybe some of them are interesting:
>> >
>> > ==30382== Conditional jump or move depends on uninitialised value(s)
>> > ==30382==    at 0x4731E6: note_mouse_highlight (xdisp.c:26841)
>> > ==30382==    by 0x4F8682: note_mouse_movement (xterm.c:3830)
>> > ==30382==    by 0x4FCB2E: handle_one_xevent (xterm.c:6652)
>> > ==30382==    by 0x4FD792: XTread_socket (xterm.c:7133)
>> > ==30382==    by 0x5437F7: read_avail_input (keyboard.c:6821)
>> > ==30382==    by 0x54409F: handle_async_input (keyboard.c:7149)
>> > ==30382==    by 0x5440BE: process_pending_signals (keyboard.c:7165)
>> > ==30382==    by 0x62D713: wait_reading_process_output (process.c:4340)
>> > ==30382==    by 0x419ED2: sit_for (dispnew.c:5971)
>> > ==30382==    by 0x53AF87: read_char (keyboard.c:2687)
>> > ==30382==    by 0x548876: read_key_sequence (keyboard.c:9290)
>> > ==30382==    by 0x538709: command_loop_1 (keyboard.c:1447)
>> 
>> This is because window_from_coordinates in note_mouse_highlight is
>> passed "&part", where "part" is an uninitialized local variable.
>> When !NILP(window) "part" is not touched, so it stays uninitialized.
>
> That's not my reading of the code.  Here's what happens in
> window_from_coordinates:
>
>   window = Qnil;
>   cw.window = &window, cw.x = x, cw.y = y; cw.part = part;
>   foreach_window (f, check_window_containing, &cw);
>
> So cw.part now holds "part", which is a pointer.
> check_window_containing does this:
>
>   found = coordinates_in_window (w, cw->x, cw->y);
>   if (found != ON_NOTHING)
>     {
>       *cw->part = found;
>       XSETWINDOW (*cw->window, w);
>
> So if it finds a window, it touches "part" through cw->part and sets
> `window' (through cw->window) to a non-nil value.  Now back in
> window_from_coordinates:
>
>   if (NILP (window)
>       && tool_bar_p
>       && WINDOWP (f->tool_bar_window)
>       && WINDOW_TOTAL_LINES (XWINDOW (f->tool_bar_window)) > 0
>       && (coordinates_in_window (XWINDOW (f->tool_bar_window), x, y)
>         != ON_NOTHING))
>     {
>       *part = ON_TEXT;
>       window = f->tool_bar_window;
>     }
>
> If `window' is non-nil, "part" was already set inside
> check_window_containing, so there's no need to set it again.
>
> Am I missing something or did this tricky code dupe valgrind?

I don't know anything about this code... 
A quick hack to initialize part with -42 and then abort if it's still -42 before
 "part != ON_TEXT && part != ON_MODE_LINE && part != ON_HEADER_LINE"
does indeed call abort... 



reply via email to

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