emacs-devel
[Top][All Lists]
Advanced

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

Re: buffer.c/buffer.h: How to add new buffer-local variables?


From: Eli Zaretskii
Subject: Re: buffer.c/buffer.h: How to add new buffer-local variables?
Date: Mon, 08 Apr 2019 18:04:28 +0300

> Date: Mon, 08 Apr 2019 12:37:57 +0300
> From: Eli Zaretskii <address@hidden>
> Cc: address@hidden, address@hidden, address@hidden,
>       address@hidden
> 
> The problem is caused by the 4-byte hole between the last Lisp_Object member 
> of the buffer structure and the beginning of struct buffer_text.  It causes 
> us to decide that a buffer has 83 Lisp components, whereas it actually has 
> only 82.  The hole is left uninitialized, and causes the segfault when we try 
> to use it as a valid object.

To clarify, I meant this hole:

> /*  324      |     4 */    Lisp_Object extra_line_spacing_;
> /*  328      |     4 */    Lisp_Object cursor_in_non_selected_windows_;
> /* XXX  4-byte hole  */  <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
> /*  336      |   104 */    struct buffer_text {
> /*  336      |     4 */        unsigned char *beg;

Significantly, it doesn't show in what Paul saw in a 32-bit Fedora
build.  I guess the MS-Windows port of GCC has some special rules in
this case, perhaps triggered by the fact that some members of 'struct
buffer_text' are now 64-bit integers, and perhaps GCC on Windows wants
them 8-byte aligned?

> I guess we need to make BUFFER_LISP_SIZE smarter?

Not sure how, though.  Perhaps we should simply make BUFFER_LISP_SIZE
a literal number and request whoever extends 'struct buffer' to keep
that in sync manually?



reply via email to

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