From: Eli Zaretskii <eliz@gnu.org>
To: Paul Eggert <eggert@cs.ucla.edu>
Cc: emacs-devel@gnu.org
Subject: eassert always aborts in eval.c in an optimized build
Date: Sun, 27 Oct 2024 10:50:28 +0200 [thread overview]
Message-ID: <8634kiaq0b.fsf@gnu.org> (raw)
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.
next reply other threads:[~2024-10-27 8:50 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-27 8:50 Eli Zaretskii [this message]
2024-10-27 17:57 ` eassert always aborts in eval.c in an optimized build 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8634kiaq0b.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=eggert@cs.ucla.edu \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).