unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* eassert always aborts in eval.c in an optimized build
@ 2024-10-27  8:50 Eli Zaretskii
  2024-10-27 17:57 ` Paul Eggert
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2024-10-27  8:50 UTC (permalink / raw)
  To: Paul Eggert; +Cc: emacs-devel

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.



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-10-28 13:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-27  8:50 eassert always aborts in eval.c in an optimized build Eli Zaretskii
2024-10-27 17:57 ` Paul Eggert
2024-10-27 19:26   ` Eli Zaretskii
2024-10-27 19:30     ` Paul Eggert
2024-10-28  0:34   ` Paul Eggert
2024-10-28 13:49     ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).