Subject: bug#6031: gcc 4.5 breaks optimized builds of emacs

From: Elias Pipping <[email-masked]>
Date: Tue, 27 Apr 2010 00:41:21 +0200

On Sun, Apr 25, 2010 at 6:15 PM, Eli Zaretskii <[email-masked]> wrote:
>> From: Elias Pipping <[email-masked]>
>> Date: Sun, 25 Apr 2010 16:56:20 +0200
>> Cc: [email-masked]
>>
>> (gdb) p text
>> $1 = (struct glyph *) 0x1163000
>> (gdb) p end
>> $2 = (struct glyph *) 0x7ffff73525fa
>
> Hmm... `end' looks entirely bogus to me...  It should have been much
> smalle.  Can you set a watchpoint at the address of row->glyphs[3],
> and see who puts there a non-null value?  Here's how to do that:
>
>   In the crashed session:
>   (gdb) p &row->glyphs[3]
>   $1 = (struct glyph **) 0x12345678
>
>   Start a new session:
>   gdb ./emacs
>   (gdb) start -Q -nw
>   (gdb) watch *(struct glyph **) 0x12345678
>   (gdb) continue
>
> 0x12345678 is of course just an example, you will actually see some
> other value.

(after quite a couple of changes to it):

Hardware watchpoint 2: *(struct glyph **) 0x1126868

Old value = (struct glyph *) 0xa35312d39353838
New value = (struct glyph *) 0x0
0x00007ffff7639f58 in memset () from /lib/libc.so.6
(gdb)

after that, before the watchpoint is hit again, the segfault occurs.

> You should see one change of the value here (line 673 in dispnew.c):
>
>      matrix->rows = (struct glyph_row *) xrealloc (matrix->rows, size);
>      bzero (matrix->rows + matrix->rows_allocated,
>             new_rows * sizeof *matrix->rows);
>
> The value should change to a NULL pointer.  You should then see
> another change in the loop which starts on line 697 in dispnew.c:
>
>      for (i = 0; i < dim.height; ++i)
>
> The value should change from a NULL pointer to something non-null.
>
> There should be some more similar changes.  Please see which one of
> them puts the bogus value 0x7ffff73525fa or some such there.
>
> Thanks.

Kind regards,

Elias