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

From: Eli Zaretskii <[email-masked]>
Date: Sun, 25 Apr 2010 19:15:05 +0300

> 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.

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.