bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#8546: fix for Emacs pseudovector incompatibility with GCC 4.6.0


From: Eli Zaretskii
Subject: bug#8546: fix for Emacs pseudovector incompatibility with GCC 4.6.0
Date: Mon, 25 Apr 2011 13:23:13 +0300

> Date: Mon, 25 Apr 2011 00:41:58 -0700
> From: Paul Eggert <address@hidden>
> 
>   #define XSETPSEUDOVECTOR(a, b, code) \
>     (XSETVECTOR (a, b),                                                       
> \
>      eassert ((XVECTOR (a)->size & (PSEUDOVECTOR_FLAG | PVEC_TYPE_MASK))      
> \
>             == (PSEUDOVECTOR_FLAG | (code))))
> 
> Here's the generated x86 code, with the problem highlighted:
> 
>               movl    $buffer_local_symbols, %eax
>               movl    $1, %edx
>               call    reset_buffer_local_variables
>               movl    $buffer_defaults, %eax
>               orl     $5, %eax
>               movl    %eax, Vbuffer_defaults
>               andl    $-8, %eax
>       0=>     movl    (%eax), %eax
>       1=>     orl     $1073872896, buffer_defaults
>               movl    $buffer_defaults+8, buffer_defaults+76
>               andl    $1082129920, %eax
>       2=>     cmpl    $1073872896, %eax
>               movl    $buffer_local_symbols+8, buffer_local_symbols+76
>               movl    $0, buffer_defaults+64
>               movl    $0, buffer_local_symbols+64
>               je      .L2396
>               movl    suppress_checking, %eax
>               testl   %eax, %eax
>               je      .L2398
>       .L2396:
> 
> The code marked (1) implements the expansion of XSETPVECTYPE, and sets
> buffer_defaults.size to 0x40020000, the mark for a buffer.  The code
> marked (2) is part of the expansion of the eassert, and it checks that
> XVECTOR (Vbuffer_defaults)->size has the proper flag and code.  But
> (2) is relying on a *cached* copy of the size, which was loaded in (0),
> and (0) precedes (1).  So, the assertion fails.

Could you please tell more what is it in the Emacs macros that
triggers this problem?  You say that "Emacs's pseudovector
implementation dissembles about the types", but could you please point
out where in the code this happens?  I'm afraid I don't see it, but
then I'm no expert on compiler optimizations and on how they interact
with C types.

TIA





reply via email to

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