From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#42360: [feature/native-comp] miscompilation(?) of functions with non local exits Date: Wed, 15 Jul 2020 15:17:27 -0400 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13261"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: 42360@debbugs.gnu.org To: Andrea Corallo Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jul 15 21:18:12 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1jvmuw-0003L0-Tl for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 15 Jul 2020 21:18:11 +0200 Original-Received: from localhost ([::1]:33404 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jvmuv-000518-Fn for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 15 Jul 2020 15:18:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53144) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jvmuo-00050t-GB for bug-gnu-emacs@gnu.org; Wed, 15 Jul 2020 15:18:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:42088) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jvmuo-0000lv-6w for bug-gnu-emacs@gnu.org; Wed, 15 Jul 2020 15:18:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jvmuo-0001Wh-2G for bug-gnu-emacs@gnu.org; Wed, 15 Jul 2020 15:18:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 15 Jul 2020 19:18:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 42360 X-GNU-PR-Package: emacs X-Debbugs-Original-Cc: bug-gnu-emacs@gnu.org, Eli Zaretskii Original-Received: via spool by submit@debbugs.gnu.org id=B.15948406565833 (code B ref -1); Wed, 15 Jul 2020 19:18:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 15 Jul 2020 19:17:36 +0000 Original-Received: from localhost ([127.0.0.1]:53634 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jvmuN-0001W1-P0 for submit@debbugs.gnu.org; Wed, 15 Jul 2020 15:17:35 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:49068) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jvmuM-0001Vt-NM for submit@debbugs.gnu.org; Wed, 15 Jul 2020 15:17:35 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53010) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jvmuM-0004yC-IR for bug-gnu-emacs@gnu.org; Wed, 15 Jul 2020 15:17:34 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:52845) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jvmuK-0000h7-Cf; Wed, 15 Jul 2020 15:17:33 -0400 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 355A9808BD; Wed, 15 Jul 2020 15:17:30 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 6484F805A4; Wed, 15 Jul 2020 15:17:28 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1594840648; bh=+je70xS4DUNvW5CQ0s2d7rueCEVZe9iCaPFcEeZocW4=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=GAhUg8qjU3c76eCZY8oa39dNiWmi+33lP+lo71RP1SuhoyWIMt5qSQZ3+0V0B1tQy /b0S77nhcOlqB6ezJTBmhHfhv5+/foDNWiHt1h1oBJ94EC5nlaM/UgAel5BvoMvP9H B6pPq73GrUmCsV7nQDofX8zjcRryyUEDXPYK/w876Sql3SAETK5yWMk4OogFSdcoKv 1R6Wac4QRU18x+mfY97QtzO5JzsuzggvtUaBFNEXTWlkZ1vfXH2eBaHCCy/hQ55weE BPoqpciTLTD3x/hcuJOobAevgeiFjTYxXl4/u70b063LECsktb88+c0vtKHZp2+5d1 3xMKjLtscgoxg== Original-Received: from asado (unknown [45.72.129.42]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 2D831120642; Wed, 15 Jul 2020 15:17:28 -0400 (EDT) In-Reply-To: (Andrea Corallo's message of "Wed, 15 Jul 2020 08:24:00 +0000") Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/15 15:17:30 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:183025 Archived-At: > Three options: > > 1- Because setq is evaluated the expression should always evaluate to > t. > > 2- Unwinding the original state of the stack is restored, when it was > saved 'x' was nil so the expression should evaluate to nil. > > 3- This is unspecified. Very definitely (1)! We don't want to introduce into Elisp the kind of messy semantics you get in C with non-volatile variables and longjmp. > FYI 1 implies C register variables cannot be used to implement Lisp > local variable if non local exits are present. IIUC, the problem only occurs for those vars which have a `condition-case` (or `unwind-protect` or `catch`) in their scope and where the var is modified within that construct and that a non-local exit can jump to the end of that construct after the var was thus modified, and that the var is used after the construct. This should be fairly rare (not sure if those cases can easily be written differently, OTOH). The compiler could replace those vars by boxing them inside a cons-cell (so the register-stored C var is immutable and contains a pointer to a cons cell which holds the real value in the `car`), just like we do with mutated Elisp vars captured by closures. Stefan