emacs-devel
[Top][All Lists]
Advanced

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

eassert always aborts in eval.c in an optimized build


From: Eli Zaretskii
Subject: eassert always aborts in eval.c in an optimized build
Date: Sun, 27 Oct 2024 10:50:28 +0200

Something is wrong with our definition/use of eassert in eval.c when
Emacs is compiled with optimizations and with --enable-checking: all
the functions in eval.c that assert pdl->kind's value are compiled
into code that always aborts.  Here's one example:

  Lisp_Object
  backtrace_function (union specbinding *pdl)
  {
    eassert (pdl->kind == SPECPDL_BACKTRACE);
    return pdl->bt.function;
  }

  (gdb) disassemble backtrace_function
  Dump of assembler code for function backtrace_function:
     0x000055880a6b9e0f <+0>:     push   %rax
     0x000055880a6b9e10 <+1>:     pop    %rax
     0x000055880a6b9e11 <+2>:     mov    $0x72,%edx
     0x000055880a6b9e16 <+7>:     lea    0x31821b(%rip),%rsi        # 
0x55880a9d2038
     0x000055880a6b9e1d <+14>:    lea    0x3186b4(%rip),%rdi        # 
0x55880a9d24d8
     0x000055880a6b9e24 <+21>:    push   %rax
     0x000055880a6b9e25 <+22>:    call   0x55880a6b51f6 <die>
  End of assembler dump.

It sounds like GCC decided that pdl->kind == SPECPDL_BACKTRACE is
_always_ false, and that suppress_checking is also always false.  But
why does it decide that?

This means one cannot build an optimized Emacs with --enable-checking
and be able to invoke xbacktrace from GDB, so we should fix this ASAP.

It goes without saying that other uses of eassert elsewhere in Emacs
do appear to work, and the code generated for them does test the
conditions.

Thanks.



reply via email to

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