emacs-devel
[Top][All Lists]
Advanced

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

Re: Lisp_Marker size on 32bit systems


From: Eli Zaretskii
Subject: Re: Lisp_Marker size on 32bit systems
Date: Fri, 07 Sep 2018 17:19:21 +0300

> Cc: address@hidden, address@hidden
> From: Paul Eggert <address@hidden>
> Date: Fri, 7 Sep 2018 06:45:48 -0700
> 
> >    In file included from lisp.h:35:0,
> >                from window.c:25:
> >    ../lib/verify.h:207:21: error: static assertion failed: "verify 
> > (header_size == sizeof (union vectorlike_header))"
> 
> It works for me in that configuration in Fedora 28. I get the following 
> values; 
> what do you get?
> 
> sizeof (ptrdiff_t) = 4
> sizeof (union vectorlike_header) = 4
> offsetof (struct Lisp_Vector, contents) = 4
> offsetof (struct Lisp_Sub_Char_Table, depth) == 4
> offsetof (struct Lisp_Sub_Char_Table, contents) == 12

I obtained the below by building Emacs after commenting out the
offending 'verify':

  (gdb) ptype union vectorlike_header
  type = union vectorlike_header {
      ptrdiff_t size;
  }
  (gdb) p sizeof(union vectorlike_header)
  $3 = 4
  (gdb) ptype /o struct Lisp_Vector
  /* offset    |  size */  type = struct Lisp_Vector {
  /*    0      |     4 */    union vectorlike_header {
  /*                 4 */        ptrdiff_t size;

                                 /* total size (bytes):    4 */
                             } header;
  /* XXX  4-byte hole  */
  /*    8      |     0 */    Lisp_Object contents[];

                             /* total size (bytes):    8 */
                           }
  (gdb) p sizeof(ptrdiff_t)
  $4 = 4
  (gdb) ptype /o struct Lisp_Sub_Char_Table
  /* offset    |  size */  type = struct Lisp_Sub_Char_Table {
  /*    0      |     4 */    union vectorlike_header {
  /*                 4 */        ptrdiff_t size;

                                 /* total size (bytes):    4 */
                             } header;
  /*    4      |     4 */    int depth;
  /*    8      |     4 */    int min_char;
  /* XXX  4-byte hole  */
  /*   16      |     0 */    Lisp_Object contents[];

                             /* total size (bytes):   16 */
                           }

I think GCC aligns the Lisp_Object array within the structures because
a Lisp_Object is an 8-byte data type in this configuration.



reply via email to

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