From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: eassert always aborts in eval.c in an optimized build Date: Sun, 27 Oct 2024 10:50:28 +0200 Message-ID: <8634kiaq0b.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7261"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Paul Eggert Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Oct 27 09:51:33 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1t4yzk-0001hu-I1 for ged-emacs-devel@m.gmane-mx.org; Sun, 27 Oct 2024 09:51:32 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t4yyx-0001uh-Q0; Sun, 27 Oct 2024 04:50:43 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t4yyw-0001uN-3i for emacs-devel@gnu.org; Sun, 27 Oct 2024 04:50:42 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t4yyu-0001nT-Sz; Sun, 27 Oct 2024 04:50:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=Subject:To:From:Date:mime-version:in-reply-to: references; bh=R8I3Pj4eOLID4FC9vnzu/pSboxddrq0nx+FrsnmmBf4=; b=VV1oSYNH2p5qHL Xxc5PXfy2R3up6oUIa5syjnRggdcjns5SuqvGnvvM6RXOFZZ+/dUZyCk+L/PoMO3+tEwOVIFSHAch bpOMpAsn0lehQ6i60sYHe0dY6NiWoV601CK8BOU9zNJCFmIQEcN+nRCuUUiZ2eotDqQgUwYpc7e40 Z310B/FUOzp21oLKljCcgv2+ChyHpLP4+nz0DwZ3/HzdNIZnFvF42uinhiUklQI8N3xzTHsn65PyD ZKDbOweyDJmb1djQOMaBqPYlnBkg4D2LkNpJQoq0EGkgjH0aD6HVn9LdXBV+XFSZM61VRUqIudmg3 hc948Mcdf9IUukzoqBeA==; X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:324877 Archived-At: 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 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.