Subject: bug#6618: Bug was probably introduced by revision 100788

From: Bernhard Herzog <[email-masked]>
Date: Tue, 13 Jul 2010 12:39:08 +0200

I'm running into the same problem and I've debugged it a little. AFAICT the 
problem was introduced with revision 100788.  The revision immediately before 
that works fine, but I can observer the problem with revision 100788.  The 
ChangeLog entry for this is

2010-07-12  Kenichi Handa  <[email-masked]>

       * font.h (enum font_property_index): New member FONT_ENTITY_INDEX.

       * font.c (font_open_entity): Record ENTITY in FONT_OBJECT's slot
       of FONT_ENTITY_INDEX.
       (Ffont_get): If KEY is :otf and the font-object doesn't have the
       property, get the property value dynamically.
       (Ffont_put): Accept font-entity and font-object too.
       (Ffont_get_glyhphs): Renamed from Fget_font_glyphs.  Arguments and
       return value changed.
       (syms_of_font): Adjusted for the above change.

It's most likely the first change in font.c: "Record ENTITY in FONT_OBJECT's 
slot of FONT_ENTITY_INDEX.":

--- src/font.c  2010-07-11 10:31:10 +0000
+++ src/font.c  2010-07-12 02:28:50 +0000
@@ -3005,7 +3005,7 @@
     return Qnil;
   ASET (entity, FONT_OBJLIST_INDEX,
        Fcons (font_object, AREF (entity, FONT_OBJLIST_INDEX)));
-  ASET (font_object, FONT_OBJLIST_INDEX, Qnil);
+  ASET (font_object, FONT_ENTITY_INDEX, entity);
   num_fonts++;
 
   font = XFONT_OBJECT (font_object);

This introduces circular references: font_object now refers to entity and 
entity refers back to font_object.  This probably leads to the stack overflow 
in equal later on.  A backtrace in gdb looks like this, after about 200 
recursive calls of internal_equal:

#200 0x081a2012 in internal_equal (o1=<value optimized out>, o2=149618949, 
    depth=<value optimized out>, props=0) at fns.c:2127
#201 0x081a2012 in internal_equal (o1=<value optimized out>, o2=149761965, 
    depth=<value optimized out>, props=0) at fns.c:2127
#202 0x081a21ba in Fequal (o1=141309301, o2=149761965) at fns.c:2015
#203 0x080ddd67 in Finternal_set_lisp_face_attribute (face=138409674, 
    attr=138389402, value=149761965, frame=150016069) at xfaces.c:3288

  Bernhard