From debbugs-submit-bounces@debbugs.gnu.org Tue Dec 10 11:56:03 2024 Received: (at submit) by debbugs.gnu.org; 10 Dec 2024 16:56:03 +0000 Received: from localhost ([127.0.0.1]:59395 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tL3Wk-0006LE-OE for submit@debbugs.gnu.org; Tue, 10 Dec 2024 11:56:03 -0500 Received: from lists.gnu.org ([209.51.188.17]:34370) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tL3Wj-0006Kh-DA for submit@debbugs.gnu.org; Tue, 10 Dec 2024 11:56:01 -0500 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 1tL3We-0003d9-Oq for bug-gnu-emacs@gnu.org; Tue, 10 Dec 2024 11:55:57 -0500 Received: from mail.risk-engineering.org ([2a01:4f8:c0c:a3f8::1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tL3Wc-0005Ok-2f for bug-gnu-emacs@gnu.org; Tue, 10 Dec 2024 11:55:56 -0500 DKIM-Signature: a=rsa-sha256; bh=L4bHhdgpmhsWX0oNDflsYvFo8zjYlXqiG7bvldHbLYU=; c=relaxed/relaxed; d=risk-engineering.org; h=Subject:Subject:Sender:To:To:Cc:From:From:Date:Date:MIME-Version:MIME-Version:Content-Type:Content-Type:Content-Transfer-Encoding:Reply-To:In-Reply-To:Message-Id:Message-Id:References:Autocrypt:Openpgp; i=@risk-engineering.org; s=default; t=1733849784; v=1; x=1734281784; b=mUD0FXELGn6l8Kss8LCFb3aT4Rl+iplDDDXk0QToriYB+vQ+tJGHfv3cUUmLGV7nf+ebNsMo 9T6l8Cxo/eZ9m+CH2XuHd9I9Sq2NLjWDSUnjEAoQLsPvk/0OaGF+H1Yk+pMHhV/sz+5wJ/AXawf VatBlS1vXFOd1TwpDfcsNJw4tlBau/lnWCrWtujK+xQJ8fwmb4i9+sC+JlDwQ8y/an/hLPp1KXA UoLUmy5SZcE+T8fwRrYpActX1j23zDnsHHBgoL088o925IykOox5+TB5i+Bw2lmlgz1Spos0df7 mAFTr0LgBomI3oF+K1JmNy2iWDY/YIZMPv+XtAZeyGzmQ== Received: by mail.risk-engineering.org (envelope-sender ) with ESMTPS id f3158dc9; Tue, 10 Dec 2024 17:56:24 +0100 Content-Type: multipart/mixed; boundary="------------HU0BgGQcJTHB0VwisiJ7Orqy" Message-ID: <0446a656-1fa2-4160-a8ba-69c060a52589@risk-engineering.org> Date: Tue, 10 Dec 2024 17:55:46 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: bug-gnu-emacs@gnu.org From: Eric Marsden Subject: Native compilation bug with struct predicates when lexical binding enabled (HEAD) Received-SPF: pass client-ip=2a01:4f8:c0c:a3f8::1; envelope-from=eric.marsden@risk-engineering.org; helo=mail.risk-engineering.org X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) This is a multi-part message in MIME format. --------------HU0BgGQcJTHB0VwisiJ7Orqy Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Hi, With the attached source file, Emacs miscompiles the struct predicate such that a repeated call to the predicate on a non-struct object returns t. This occurs with current HEAD on Linux/AMD64, but not on the Emacs 30.0.92 pretest. It does not occur when the lexical binding cookie is not present. % /opt/emacs/bin/emacs -Q --batch --eval "(load (native-compile \"/tmp/bug.el\"))" -f run Loading /home/emarsden/.emacs.d/eln-cache/31.0.50-c021c983/bug-59c4b27c-c70072f9.eln (native compiled elisp)... Running in GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.43, cairo version 1.18.2)  of 2024-12-09 is? nil is? t   ;; expecting nil bar: 111 --------------HU0BgGQcJTHB0VwisiJ7Orqy Content-Type: text/x-emacs-lisp; charset=UTF-8; name="bug.el" Content-Disposition: attachment; filename="bug.el" Content-Transfer-Encoding: base64 Ozs7ICAgLSotIGxleGljYWwtYmluZGluZzogdCAtKi0KOzsKOzsgL29wdC9lbWFjcy9iaW4v ZW1hY3MgLVEgLS1iYXRjaCAtTCAuIC0tZXZhbCAiKGxvYWQgKG5hdGl2ZS1jb21waWxlIFwi L3RtcC9idWcuZWxcIikpIiAtZiBydW4KCihyZXF1aXJlICdjbC1saWIpCgooY2wtZGVmc3Ry dWN0IGZvb2JsZXMgYmFyIGJheikKCihkZWZ1biBidWcgKGZvbykKICAobWVzc2FnZSAiaXM/ ICVzIiAoZm9vYmxlcy1wIGZvbykpCiAgKG1lc3NhZ2UgImlzPyAlcyIgKGZvb2JsZXMtcCBm b28pKQogIChtZXNzYWdlICJiYXI6ICVzIiAoZm9vYmxlcy1iYXIgZm9vKSkpCgooZGVmdW4g cnVuICgpCiAgKG1lc3NhZ2UgIlJ1bm5pbmcgaW4gJXMiICh2ZXJzaW9uKSkKICAobGV0ICgo Zm9vICJmb28iKSkKICAgIChidWcgZm9vKSkpCgoKCg== --------------HU0BgGQcJTHB0VwisiJ7Orqy-- From debbugs-submit-bounces@debbugs.gnu.org Tue Dec 10 16:21:17 2024 Received: (at 74771) by debbugs.gnu.org; 10 Dec 2024 21:21:17 +0000 Received: from localhost ([127.0.0.1]:59812 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tL7fR-0002ZG-AZ for submit@debbugs.gnu.org; Tue, 10 Dec 2024 16:21:17 -0500 Received: from mail-4316.protonmail.ch ([185.70.43.16]:42827) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tL7fO-0002YM-G2 for 74771@debbugs.gnu.org; Tue, 10 Dec 2024 16:21:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1733865668; x=1734124868; bh=AGpgk17BWxs/uHembsjpoEOXRloBeStBQCxfnwm2d00=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector:List-Unsubscribe:List-Unsubscribe-Post; b=pZbrWF3P33Dxib/iDGBDCaG8Pemx5ZrImGj4gydSpd0IsYCHfEC0lfKefdoruUb+Y +zgcLPR7r/4+FfDrLKcdeRGOYujtVGgxzUEoPWTxJcAU6JgRo427ObnTXqjDpwZ4DT IEUnM90evJrDCeAHPHLHqZABDrlRhcqd6bvF7DEmzbzrfkBmXWTQ5nSOYigAS/qs/x gWbK9nWbq8FzRfsTeNhXox98B+56wmQAsBcV9fcGrKVVhueyXN/dk9fAzWm8Latf+u PD9GT64JVZf1tcsUw/WUG6eYomUtZqBEwQ75LDeZED0uOxmURDpgeUBsIxI3kU1t3/ BcjSFzAYS4cmQ== Date: Tue, 10 Dec 2024 21:21:04 +0000 To: Eric Marsden From: Pip Cet Subject: Re: bug#74771: Native compilation bug with struct predicates when lexical binding enabled (HEAD) Message-ID: <87jzc7me0b.fsf@protonmail.com> In-Reply-To: <0446a656-1fa2-4160-a8ba-69c060a52589@risk-engineering.org> References: <0446a656-1fa2-4160-a8ba-69c060a52589@risk-engineering.org> Feedback-ID: 112775352:user:proton X-Pm-Message-ID: 7aab1edf49afcfdf44708eb1f8ef9b0dace55ef4 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 74771 Cc: 74771@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) "Eric Marsden" writes: > Hi, > > With the attached source file, Emacs miscompiles the struct predicate suc= h > that a repeated call to the predicate on a non-struct object returns t. > This occurs with current HEAD on Linux/AMD64, but not on the Emacs 30.0.9= 2 > pretest. It does not occur when the lexical binding cookie is not present= . > > % /opt/emacs/bin/emacs -Q --batch --eval "(load (native-compile \"/tmp/bu= g.el\"))" -f run > Loading /home/emarsden/.emacs.d/eln-cache/31.0.50-c021c983/bug-59c4b27c-c= 70072f9.eln (native compiled elisp)... > Running in GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version = 3.24.43, cairo version 1.18.2) > =C2=A0of 2024-12-09 > is? nil > is? t=C2=A0=C2=A0 ;; expecting nil > bar: 111 > > [2. text/x-emacs-lisp; bug.el]... Can you try this patch? diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el index 0d40f05bef1..c3e9a8be66d 100644 --- a/lisp/emacs-lisp/comp.el +++ b/lisp/emacs-lisp/comp.el @@ -2029,15 +2029,18 @@ comp--add-cond-cstrs (call symbol-value ,(and (pred comp-cstr-cl-tag-p) mvar-tag)= )) (set ,(and (pred comp-mvar-p) mvar-3) (call memq ,(and (pred comp-mvar-p) mvar-1) ,(and (pred comp= -mvar-p) mvar-2))) - (cond-jump ,(and (pred comp-mvar-p) mvar-3) ,(pred comp-mvar-p) ,= bb1 ,bb2)) - (comp--emit-assume 'and mvar-tested - (make--comp-mvar :type (comp-cstr-cl-tag mvar-tag= )) - (comp--add-cond-cstrs-target-block b bb2) - nil) - (comp--emit-assume 'and mvar-tested - (make--comp-mvar :type (comp-cstr-cl-tag mvar-tag= )) - (comp--add-cond-cstrs-target-block b bb1) - t)) + (cond-jump ,(and (pred comp-mvar-p) mvar-3) ,(and (pred comp-mvar= -p) mvar-4) ,bb1 ,bb2)) + (cond + ((and (comp-cstr-imm-vld-p mvar-4) + (eq (comp-cstr-imm mvar-4) t)) + (comp--emit-assume 'and mvar-tested + (make--comp-mvar :type (comp-cstr-cl-tag mvar-= tag)) + (comp--add-cond-cstrs-target-block b bb2) + nil) + (comp--emit-assume 'and mvar-tested + (make--comp-mvar :type (comp-cstr-cl-tag mvar-= tag)) + (comp--add-cond-cstrs-target-block b bb1) + t)))) (`((set ,(and (pred comp-mvar-p) cmp-res) (,(pred comp--call-op-p) ,(and (or (pred comp--equality-fun-p) IIUC, the code blindly assumes that cond-jump would use t as its second argument. In your code, the second argument was nil, so the assumptions were put into the wrong basic blocks. It looks like there are quite a few such assumptions in comp.el. I think we should fix them all to ensure that they test for truth, not falsehood. After that, we'll have to decide whether it's worth it to optimize the negated cases. Pip From debbugs-submit-bounces@debbugs.gnu.org Tue Dec 10 17:12:18 2024 Received: (at 74771) by debbugs.gnu.org; 10 Dec 2024 22:12:18 +0000 Received: from localhost ([127.0.0.1]:59899 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tL8So-00070H-Fd for submit@debbugs.gnu.org; Tue, 10 Dec 2024 17:12:18 -0500 Received: from mail-40134.protonmail.ch ([185.70.40.134]:17291) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tL8Sl-0006zW-SA for 74771@debbugs.gnu.org; Tue, 10 Dec 2024 17:12:16 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1733868729; x=1734127929; bh=ECz+GABjbmQg6rV1h1I3os4NfX5GAshKYYs9fTTP/oE=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector:List-Unsubscribe:List-Unsubscribe-Post; b=OyEnIsy9T12lkRAhMml0Nbuxqw4n5gdLNG5e4cJxGlKKtPl7oj0DbZZdXP6BIcHeA cPHuhpDoJDLVE4nste0G4B3+qyptWtJIyl2UlMd0UhmyFbbC9udW0gZltkGX7sAPaw 0ZFUGcXKY+quPJ9Nc60diQYM6HXBDtB1QcRqKkAyYQV7Y4ZCklaA0t3mqt01iq8eRo a0UkRBEDAXWn9LUh+ALV2tBLDz+J9b5MoxCFlXQR0oNBsEys9zrJFxZWwuVr2+EhOu Q6KkLbkcT8d2XlkBUbkCl7Ffa6mmccr5LPnPooL+ESdfYHsTXkdGUFEdtl7yOnQEMq BsihNXtUD50ag== Date: Tue, 10 Dec 2024 22:12:03 +0000 To: Eric Marsden From: Pip Cet Subject: Re: bug#74771: Native compilation bug with struct predicates when lexical binding enabled (HEAD) Message-ID: <87frmvmbnb.fsf@protonmail.com> In-Reply-To: <0446a656-1fa2-4160-a8ba-69c060a52589@risk-engineering.org> References: <0446a656-1fa2-4160-a8ba-69c060a52589@risk-engineering.org> Feedback-ID: 112775352:user:proton X-Pm-Message-ID: 6d9ec4763e42cee9b40475194568e73d7de7dab4 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 74771 Cc: 74771@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Pip Cet writes: > IIUC, the code blindly assumes that cond-jump would use t as its second > argument. In your code, the second argument was nil, so the assumptions > were put into the wrong basic blocks. I did not understand correctly. It seems cond-jump is still limited to a nil second argument, which is an undocumented assumption that comp.el continues to rely on. I still think comp--emit-assume does the wrong thing when negating an assumption, but we've been there before... Pip From debbugs-submit-bounces@debbugs.gnu.org Wed Dec 11 07:32:31 2024 Received: (at 74771) by debbugs.gnu.org; 11 Dec 2024 12:32:31 +0000 Received: from localhost ([127.0.0.1]:33347 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tLLtH-0004Pq-3Z for submit@debbugs.gnu.org; Wed, 11 Dec 2024 07:32:31 -0500 Received: from eggs.gnu.org ([209.51.188.92]:60914) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tLLtF-0004PX-AM for 74771@debbugs.gnu.org; Wed, 11 Dec 2024 07:32:30 -0500 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 1tLLt8-000832-N7; Wed, 11 Dec 2024 07:32:22 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=9ZzBinerJzUgxjjvjYHlP+RfNUvA0YNgXHOTyeSegAc=; b=ez0QWNcz+0sG MS7ohonddI7179sRD/pn9h/wJhvIc7nYLk+NBgAHA4Td3AqGzQvtos41FgNEz2QY7tkeFrZ+jea5N e5lGBPJW/EWWgUI1sEwhiHYPpFzu5MCH7NydiDYIOtSc+RBu3J/bL9D39SHrk3UvYos+DqTcrKuhh hcZkCPH5Q5ReuH5GxJ2/47PxPgh69Z/KBa7V9V2hKZrzLCsX1uM8DVvFBN/UXgLhaD512GjokF03c xVvsAoOKMsSIcMQ4fAJAFmfJOQ7CoqokqiRGZxc7THEfVwYLAf3ModlMapeIyCpfRJ/rFDj3busZG UAfTG03/FxIbPxUsjN+7hQ==; Date: Wed, 11 Dec 2024 14:32:15 +0200 Message-Id: <86ldwm4cz4.fsf@gnu.org> From: Eli Zaretskii To: Pip Cet , Andrea Corallo In-Reply-To: <87frmvmbnb.fsf@protonmail.com> (bug-gnu-emacs@gnu.org) Subject: Re: bug#74771: Native compilation bug with struct predicates when lexical binding enabled (HEAD) References: <0446a656-1fa2-4160-a8ba-69c060a52589@risk-engineering.org> <87frmvmbnb.fsf@protonmail.com> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 74771 Cc: 74771@debbugs.gnu.org, eric.marsden@risk-engineering.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Cc: 74771@debbugs.gnu.org > Date: Tue, 10 Dec 2024 22:12:03 +0000 > From: Pip Cet via "Bug reports for GNU Emacs, > the Swiss army knife of text editors" > > Pip Cet writes: > > > IIUC, the code blindly assumes that cond-jump would use t as its second > > argument. In your code, the second argument was nil, so the assumptions > > were put into the wrong basic blocks. > > I did not understand correctly. It seems cond-jump is still limited to > a nil second argument, which is an undocumented assumption that comp.el > continues to rely on. > > I still think comp--emit-assume does the wrong thing when negating an > assumption, but we've been there before... Let's hear from Andrea (CC'ed) about this. From debbugs-submit-bounces@debbugs.gnu.org Wed Dec 11 09:01:28 2024 Received: (at 74771) by debbugs.gnu.org; 11 Dec 2024 14:01:28 +0000 Received: from localhost ([127.0.0.1]:33554 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tLNHL-0001Uj-LU for submit@debbugs.gnu.org; Wed, 11 Dec 2024 09:01:27 -0500 Received: from mail-40131.protonmail.ch ([185.70.40.131]:11079) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tLNHH-0001UE-VH for 74771@debbugs.gnu.org; Wed, 11 Dec 2024 09:01:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1733925678; x=1734184878; bh=0jA6/DWuJXJc65oXVTsvEDTGtfM36piCvOvEFickgSo=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector:List-Unsubscribe:List-Unsubscribe-Post; b=VaWSRt7VtVANI1oBbb22ed0RGWvnXSsU3+n5ULbBCaHmIUt7EDjOBtG7jAssMXWjb uttvwTrqBahTVPO71OJ4U5LddBRLujFLn4MXTPiDTZTXLuJ/qZQwVHUAIMG46YX2gr wcZXvE/4SPeXzIAu+F30PLIynWdOZRsfjbOymvvTo8+b+fYZt3PI3KQiDoDHl1N8Fa H9cYlJ+dlMQv+Kqdp1TgbSSo3Jra5TgkOOXU9/2N/RCWQy1eEPyzI3TuAG0l3JyMdN kudh/iVECIJnd9O1WQVR8xpRl32YcXpA2NYF+glPf32zz2fxdkcD385b1NmlRLbdZu L5A9tJz094yuA== Date: Wed, 11 Dec 2024 14:01:13 +0000 To: Eli Zaretskii From: Pip Cet Subject: Re: bug#74771: Native compilation bug with struct predicates when lexical binding enabled (HEAD) Message-ID: <87frmul3pd.fsf@protonmail.com> In-Reply-To: <86ldwm4cz4.fsf@gnu.org> References: <0446a656-1fa2-4160-a8ba-69c060a52589@risk-engineering.org> <87frmvmbnb.fsf@protonmail.com> <86ldwm4cz4.fsf@gnu.org> Feedback-ID: 112775352:user:proton X-Pm-Message-ID: 5f4e4a191696d808ce7b99e41bb0bcf6575b3ae6 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 74771 Cc: Andrea Corallo , 74771@debbugs.gnu.org, eric.marsden@risk-engineering.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) "Eli Zaretskii" writes: >> Cc: 74771@debbugs.gnu.org >> Date: Tue, 10 Dec 2024 22:12:03 +0000 >> From: Pip Cet via "Bug reports for GNU Emacs, >> the Swiss army knife of text editors" >> >> Pip Cet writes: >> >> > IIUC, the code blindly assumes that cond-jump would use t as its secon= d >> > argument. In your code, the second argument was nil, so the assumptio= ns >> > were put into the wrong basic blocks. >> >> I did not understand correctly. It seems cond-jump is still limited to >> a nil second argument, which is an undocumented assumption that comp.el >> continues to rely on. >> >> I still think comp--emit-assume does the wrong thing when negating an >> assumption, but we've been there before... > > Let's hear from Andrea (CC'ed) about this. You're right. I have a new theory, but as it boils down to something that has been discussed before (whether "assume" pseudo-insns apply to individual mvars or to all mvars sharing a slot - my understanding is it has to be the latter, so we end up making invalid assumptions about the new mvar in the slot based on things we know about the old, clobbered mvar), it's best to let Andrea handle this one. I'll just disable nativecomp assume pseudo-insns for my builds as I don't want to run into this bug. Pip From debbugs-submit-bounces@debbugs.gnu.org Wed Dec 11 17:29:47 2024 Received: (at 74771) by debbugs.gnu.org; 11 Dec 2024 22:29:48 +0000 Received: from localhost ([127.0.0.1]:36629 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tLVDH-0005rh-EL for submit@debbugs.gnu.org; Wed, 11 Dec 2024 17:29:47 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39094) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tLVDF-0005rG-B1 for 74771@debbugs.gnu.org; Wed, 11 Dec 2024 17:29:46 -0500 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 1tLVD6-0005ET-MX; Wed, 11 Dec 2024 17:29:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=NEzbnZxLbMR4yYGBYu/C9Vhy6UF6fYjDe4vYnTCpEm8=; b=n0pn2+FUxlitjaP7neSj zvBkrvdKMKT6d/ki3As1mZPunCH/L8+/akYsg2uQV16q17HvJitTcCgOcv4qS/3L+8cfLaS6+lzer Ma8nDyVkaS/lSpcQNNdMWoY4DwY3F7VgBf1oJDBZA/JnNVoCvUky4syAMEkCtb8kaaW628aXprKG0 WD8DzcV4aJk6pm3FfLujWAClbZ9Qb21CD88b5ANA4sjlgTYYh3uaDlrF5XeRLlfAwMZEZ7pFefNOd dkk3WvJJYse8/XLxfnaXYgc6zdvXga2R1A2MqA0I5gvvs2VsCvnCb4rYZoIZUQhgcOw9VIisFb1Vm eyd78isakM6iNw==; Received: from acorallo by fencepost.gnu.org with local (Exim 4.90_1) (envelope-from ) id 1tLVD5-0001b2-I0; Wed, 11 Dec 2024 17:29:35 -0500 From: Andrea Corallo To: Eric Marsden Subject: Re: bug#74771: Native compilation bug with struct predicates when lexical binding enabled (HEAD) In-Reply-To: <0446a656-1fa2-4160-a8ba-69c060a52589@risk-engineering.org> (Eric Marsden's message of "Tue, 10 Dec 2024 17:55:46 +0100") References: <0446a656-1fa2-4160-a8ba-69c060a52589@risk-engineering.org> Date: Wed, 11 Dec 2024 17:29:34 -0500 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 74771 Cc: 74771@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Eric Marsden writes: > Hi, > > With the attached source file, Emacs miscompiles the struct predicate such > that a repeated call to the predicate on a non-struct object returns t. > This occurs with current HEAD on Linux/AMD64, but not on the Emacs 30.0.92 > pretest. It does not occur when the lexical binding cookie is not present. > > % /opt/emacs/bin/emacs -Q --batch --eval "(load (native-compile \"/tmp/bu= g.el\"))" -f run > Loading /home/emarsden/.emacs.d/eln-cache/31.0.50-c021c983/bug-59c4b27c-c= 70072f9.eln (native compiled elisp)... > Running in GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version = 3.24.43, cairo version 1.18.2) > =C2=A0of 2024-12-09 > is? nil > is? t=C2=A0=C2=A0 ;; expecting nil > bar: 111 > > ;;; -*- lexical-binding: t -*- > ;; > ;; /opt/emacs/bin/emacs -Q --batch -L . --eval "(load (native-compile \"/= tmp/bug.el\"))" -f run > > (require 'cl-lib) > > (cl-defstruct foobles bar baz) > > (defun bug (foo) > (message "is? %s" (foobles-p foo)) > (message "is? %s" (foobles-p foo)) > (message "bar: %s" (foobles-bar foo))) > > (defun run () > (message "Running in %s" (version)) > (let ((foo "foo")) > (bug foo))) Hi Eric, thanks for the report, I'll look at this in the coming days. Andrea From debbugs-submit-bounces@debbugs.gnu.org Sat Dec 28 05:58:36 2024 Received: (at 74771) by debbugs.gnu.org; 28 Dec 2024 10:58:36 +0000 Received: from localhost ([127.0.0.1]:48904 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tRUWh-0005u5-Rx for submit@debbugs.gnu.org; Sat, 28 Dec 2024 05:58:36 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35224) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tRUWf-0005ts-Hn for 74771@debbugs.gnu.org; Sat, 28 Dec 2024 05:58:33 -0500 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 1tRUWZ-0003MR-TW; Sat, 28 Dec 2024 05:58:27 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=UqS6CdiQulxSny/S0dwfpCaehgy40IPpALMSWunZ5AI=; b=frJnoEkrEb0Scw0+AmAv BEzxWsXNtQeDC1tcp1K8RS004DCuMhe3Q1rQYod8V4OUnstvJfA2s1FIVM/nXF/mJaLo8t7Wuee4W FXd8f6K3bAz7/58QF6dfD/F+ubvjyyg2T5AGtK6xW1oBuPrAOU/n/4FwpHvSU85s0B0jaIoiA/X6W jkDU3k7JitBkHjdQqkBLHYrATYmm7bh2QxekdmyJsE4LyapahTC9Eb897RyAB3OztEht62HR0LDDX v+pG5bCqtqvZw1EetjGgYVGBuqirDr1VYQFhCxwm5i6dhEmJhGs5cGPTM38wvqGKJAt0CtqgVJgeQ U/kZaMenKFk7Nw==; Date: Sat, 28 Dec 2024 12:58:22 +0200 Message-Id: <865xn4ul9t.fsf@gnu.org> From: Eli Zaretskii To: Andrea Corallo In-Reply-To: (message from Andrea Corallo on Wed, 11 Dec 2024 17:29:34 -0500) Subject: Re: bug#74771: Native compilation bug with struct predicates when lexical binding enabled (HEAD) References: <0446a656-1fa2-4160-a8ba-69c060a52589@risk-engineering.org> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 74771 Cc: 74771@debbugs.gnu.org, eric.marsden@risk-engineering.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Cc: 74771@debbugs.gnu.org > From: Andrea Corallo > Date: Wed, 11 Dec 2024 17:29:34 -0500 > > Eric Marsden writes: > > > Hi, > > > > With the attached source file, Emacs miscompiles the struct predicate such > > that a repeated call to the predicate on a non-struct object returns t. > > This occurs with current HEAD on Linux/AMD64, but not on the Emacs 30.0.92 > > pretest. It does not occur when the lexical binding cookie is not present. > > > > % /opt/emacs/bin/emacs -Q --batch --eval "(load (native-compile \"/tmp/bug.el\"))" -f run > > Loading /home/emarsden/.emacs.d/eln-cache/31.0.50-c021c983/bug-59c4b27c-c70072f9.eln (native compiled elisp)... > > Running in GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.43, cairo version 1.18.2) > >  of 2024-12-09 > > is? nil > > is? t   ;; expecting nil > > bar: 111 > > > > ;;; -*- lexical-binding: t -*- > > ;; > > ;; /opt/emacs/bin/emacs -Q --batch -L . --eval "(load (native-compile \"/tmp/bug.el\"))" -f run > > > > (require 'cl-lib) > > > > (cl-defstruct foobles bar baz) > > > > (defun bug (foo) > > (message "is? %s" (foobles-p foo)) > > (message "is? %s" (foobles-p foo)) > > (message "bar: %s" (foobles-bar foo))) > > > > (defun run () > > (message "Running in %s" (version)) > > (let ((foo "foo")) > > (bug foo))) > > Hi Eric, > > thanks for the report, I'll look at this in the coming days. Any progress here? From debbugs-submit-bounces@debbugs.gnu.org Sun Dec 29 04:45:03 2024 Received: (at 74771) by debbugs.gnu.org; 29 Dec 2024 09:45:03 +0000 Received: from localhost ([127.0.0.1]:53771 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tRpr5-0005qC-57 for submit@debbugs.gnu.org; Sun, 29 Dec 2024 04:45:03 -0500 Received: from eggs.gnu.org ([209.51.188.92]:40378) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tRpr3-0005pO-87 for 74771@debbugs.gnu.org; Sun, 29 Dec 2024 04:45:01 -0500 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 1tRpqx-00043f-TA; Sun, 29 Dec 2024 04:44:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=MmKr2wWBrBrLSpB9qrgyLRVj1LS4qraFC0sSqBgcOeo=; b=aYF8eNnE8Cv7e9lAL9cP bzNP4frkj19S+N05leUl/OAYabeMWV5ShdW2I2hiKI3d/qkdR6Sv2lgYq/wQkmcxNh4itpkJWIoc8 i7EsB/0HVTS30AxdCFz82L4+oZC2ncoei9gahPt6rRlp33bZj+JkzHyUvpOFgpCAXp7Ewu8AlSRQ3 9Uya032ZK4fB2hjlJymah7XP8KasILafLJfJ0jJ57adQR6ljvdIx0MKC8RT1FZL5o06JBgx1wJKl3 NhX4AeMSoGyFNVqHHV0gKdxaptt5+Ms9dobPmQvVhjrne3LCMdhZTNs1ksa+E15EFGxeL3oo9quvH EFNrXL/YYjX3Xg==; Received: from acorallo by fencepost.gnu.org with local (Exim 4.90_1) (envelope-from ) id 1tRpqx-0005YS-70; Sun, 29 Dec 2024 04:44:55 -0500 From: Andrea Corallo To: Eli Zaretskii Subject: Re: bug#74771: Native compilation bug with struct predicates when lexical binding enabled (HEAD) In-Reply-To: <865xn4ul9t.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 28 Dec 2024 12:58:22 +0200") References: <0446a656-1fa2-4160-a8ba-69c060a52589@risk-engineering.org> <865xn4ul9t.fsf@gnu.org> Date: Sun, 29 Dec 2024 04:44:55 -0500 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 74771 Cc: 74771@debbugs.gnu.org, eric.marsden@risk-engineering.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Eli Zaretskii writes: >> Cc: 74771@debbugs.gnu.org >> From: Andrea Corallo >> Date: Wed, 11 Dec 2024 17:29:34 -0500 >>=20 >> Eric Marsden writes: >>=20 >> > Hi, >> > >> > With the attached source file, Emacs miscompiles the struct predicate = such >> > that a repeated call to the predicate on a non-struct object returns t. >> > This occurs with current HEAD on Linux/AMD64, but not on the Emacs 30.= 0.92 >> > pretest. It does not occur when the lexical binding cookie is not pres= ent. >> > >> > % /opt/emacs/bin/emacs -Q --batch --eval "(load (native-compile \"/tmp= /bug.el\"))" -f run >> > Loading /home/emarsden/.emacs.d/eln-cache/31.0.50-c021c983/bug-59c4b27= c-c70072f9.eln (native compiled elisp)... >> > Running in GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Versi= on 3.24.43, cairo version 1.18.2) >> > =C2=A0of 2024-12-09 >> > is? nil >> > is? t=C2=A0=C2=A0 ;; expecting nil >> > bar: 111 >> > >> > ;;; -*- lexical-binding: t -*- >> > ;; >> > ;; /opt/emacs/bin/emacs -Q --batch -L . --eval "(load (native-compile = \"/tmp/bug.el\"))" -f run >> > >> > (require 'cl-lib) >> > >> > (cl-defstruct foobles bar baz) >> > >> > (defun bug (foo) >> > (message "is? %s" (foobles-p foo)) >> > (message "is? %s" (foobles-p foo)) >> > (message "bar: %s" (foobles-bar foo))) >> > >> > (defun run () >> > (message "Running in %s" (version)) >> > (let ((foo "foo")) >> > (bug foo))) >>=20 >> Hi Eric, >>=20 >> thanks for the report, I'll look at this in the coming days. > > Any progress here? Not so far, I'm on holiday this days so I don't have much time for coding, it's in my todo list tho. Andrea From debbugs-submit-bounces@debbugs.gnu.org Wed Jan 08 06:51:20 2025 Received: (at 74771) by debbugs.gnu.org; 8 Jan 2025 11:51:20 +0000 Received: from localhost ([127.0.0.1]:46208 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tVUal-0006on-WD for submit@debbugs.gnu.org; Wed, 08 Jan 2025 06:51:20 -0500 Received: from mail-10628.protonmail.ch ([79.135.106.28]:52871) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tVUaj-0006oK-51 for 74771@debbugs.gnu.org; Wed, 08 Jan 2025 06:51:19 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1736337070; x=1736596270; bh=O7aUALWHAK/Zc6/ii8aO3WSl5OfYodSyBkyteYaPAbc=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector:List-Unsubscribe:List-Unsubscribe-Post; b=qtzOGvam6qjRvtyUjhHYtADbaOTjYj6LdU32xPcpbPrhUEuQDhmk7UaVlmrN7ThyC s7ie4yNw9nyleqkTD6z3SVExz/UWSPz5+uqUBUscLRsHhn3QG8jlnewCKSvKG/kBDI qEMLO5jwdSmB22+ZJVnah53fzks0VR3e1Mw2xDCv2R+sFU6cSmhVAJnM6V6Qj/uHX4 SlzUIa+2LLDrEjJqeeCEE4qNIAKzwsCRqZxoUdkxQbSkYc3mRmhJGN0vOFPv8a+fK6 WZHkisIeRONRgJnRtdumtSvLSXgblIVW+AER9oqCrK4/csTxMi6UGryh7Gz1N5XtYG mCY64tPMT9MBg== Date: Wed, 08 Jan 2025 11:51:07 +0000 To: Andrea Corallo From: Pip Cet Subject: Re: bug#74771: Native compilation bug with struct predicates when lexical binding enabled (HEAD) Message-ID: <871pxdfrrr.fsf@protonmail.com> In-Reply-To: References: <0446a656-1fa2-4160-a8ba-69c060a52589@risk-engineering.org> <865xn4ul9t.fsf@gnu.org> Feedback-ID: 112775352:user:proton X-Pm-Message-ID: c65040cd37f5acea461b30c554b179eafdba2031 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 74771 Cc: Eli Zaretskii , eric.marsden@risk-engineering.org, 74771@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) "Andrea Corallo" writes: > Eli Zaretskii writes: > >>> Cc: 74771@debbugs.gnu.org >>> From: Andrea Corallo >>> Date: Wed, 11 Dec 2024 17:29:34 -0500 >>> >>> Eric Marsden writes: >>> >>> > Hi, >>> > >>> > With the attached source file, Emacs miscompiles the struct predicate= such >>> > that a repeated call to the predicate on a non-struct object returns = t. >>> > This occurs with current HEAD on Linux/AMD64, but not on the Emacs 30= .0.92 >>> > pretest. It does not occur when the lexical binding cookie is not pre= sent. >>> > >>> > % /opt/emacs/bin/emacs -Q --batch --eval "(load (native-compile \"/tm= p/bug.el\"))" -f run >>> > Loading /home/emarsden/.emacs.d/eln-cache/31.0.50-c021c983/bug-59c4b2= 7c-c70072f9.eln (native compiled elisp)... >>> > Running in GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Vers= ion 3.24.43, cairo version 1.18.2) >>> > =C2=A0of 2024-12-09 >>> > is? nil >>> > is? t=C2=A0=C2=A0 ;; expecting nil >>> > bar: 111 >>> > >>> > ;;; -*- lexical-binding: t -*- >>> > ;; >>> > ;; /opt/emacs/bin/emacs -Q --batch -L . --eval "(load (native-compile= \"/tmp/bug.el\"))" -f run >>> > >>> > (require 'cl-lib) >>> > >>> > (cl-defstruct foobles bar baz) >>> > >>> > (defun bug (foo) >>> > (message "is? %s" (foobles-p foo)) >>> > (message "is? %s" (foobles-p foo)) >>> > (message "bar: %s" (foobles-bar foo))) >>> > >>> > (defun run () >>> > (message "Running in %s" (version)) >>> > (let ((foo "foo")) >>> > (bug foo))) >>> >>> Hi Eric, >>> >>> thanks for the report, I'll look at this in the coming days. >> >> Any progress here? > > Not so far, I'm on holiday this days so I don't have much time for > coding, it's in my todo list tho. No activity in a while, so I tried reproducing this: bug's still there. Can you repeat for me what (assume #s(comp-mvar (t) nil nil nil nil nil) (not #s(comp-mvar (foobles) n= il nil nil nil nil))) is supposed to mean? To me, it appears to mean "the value of the first mvar is different from the value of the second mvar, which is of type foobles". This doesn't say anything about the type of the first mvar, assuming there is more than one value of the foobles type; if this is the correct interpretation, we need to stop copying the typeset in this case: diff --git a/lisp/emacs-lisp/comp-cstr.el b/lisp/emacs-lisp/comp-cstr.el index 3d46cc8c6ae..5d87ff75703 100644 --- a/lisp/emacs-lisp/comp-cstr.el +++ b/lisp/emacs-lisp/comp-cstr.el @@ -1176,14 +1176,11 @@ comp-cstr-value-negation "Negate values in SRC setting the result in DST. DST is returned." (with-comp-cstr-accessors - (if (or (valset src) (range src)) - (setf (typeset dst) () - (valset dst) (valset src) - (range dst) (range src) - (neg dst) (not (neg src))) - (setf (typeset dst) (typeset src) - (valset dst) () - (range dst) ())) + (and (or (valset src) (range src)) + (setf (typeset dst) () + (valset dst) (valset src) + (range dst) (range src) + (neg dst) (not (neg src)))) dst)) =20 (defun comp-cstr-negation-make (src) I see two other possibilities: 1. it means the lhs mvar is of type "foobles", but not identical to the second mvar. This is what comp-cstr-negation-make currently assumes. In this case, comp--add-cond-cstrs should not be emitting this pseudo-insn for the case in which the lhs mvar is known not to be of type "foobles", but nothing else is known about its value: diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el index 269eae315e4..d5c512fbdc3 100644 --- a/lisp/emacs-lisp/comp.el +++ b/lisp/emacs-lisp/comp.el @@ -2033,11 +2033,7 @@ comp--add-cond-cstrs (comp--emit-assume 'and mvar-tested (make--comp-mvar :type (comp-cstr-cl-tag mvar-tag= )) (comp--add-cond-cstrs-target-block b bb2) - nil) - (comp--emit-assume 'and mvar-tested - (make--comp-mvar :type (comp-cstr-cl-tag mvar-tag= )) - (comp--add-cond-cstrs-target-block b bb1) - t)) + nil)) (`((set ,(and (pred comp-mvar-p) cmp-res) (,(pred comp--call-op-p) ,(and (or (pred comp--equality-fun-p) 2. it means the lhs mvar is not of type "foobles". In this case, comp-cstr-value-negation should make the lhs mvar have a negated cstr with type "foobles": diff --git a/lisp/emacs-lisp/comp-cstr.el b/lisp/emacs-lisp/comp-cstr.el index 3d46cc8c6ae..03a00123f64 100644 --- a/lisp/emacs-lisp/comp-cstr.el +++ b/lisp/emacs-lisp/comp-cstr.el @@ -1183,7 +1183,8 @@ comp-cstr-value-negation (neg dst) (not (neg src))) (setf (typeset dst) (typeset src) (valset dst) () - (range dst) ())) + (range dst) () + (neg dst) (not (neg src)))) dst)) =20 (defun comp-cstr-negation-make (src) Note that if (2) is intended, that is a really strange interpretation of what "not" means: it's negating a cstr (a set of values), not an mvar (a specific value), so why is the argument an mvar? We could make this change, and then try to recover whichever optimizations that disables: diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el index 269eae315e4..bcc0628235a 100644 --- a/lisp/emacs-lisp/comp.el +++ b/lisp/emacs-lisp/comp.el @@ -2035,7 +2035,7 @@ comp--add-cond-cstrs (comp--add-cond-cstrs-target-block b bb2) nil) (comp--emit-assume 'and mvar-tested - (make--comp-mvar :type (comp-cstr-cl-tag mvar-tag= )) + (comp--type-to-cstr (comp-cstr-cl-tag mvar-tag)) (comp--add-cond-cstrs-target-block b bb1) t)) (`((set ,(and (pred comp-mvar-p) cmp-res) In any case, please consider documenting the pseudo-insns. not-eq-to-mvar and not-matching-cstr are two very different things! Pip From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 22 04:56:43 2025 Received: (at 74771) by debbugs.gnu.org; 22 Feb 2025 09:56:43 +0000 Received: from localhost ([127.0.0.1]:47971 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tlmFW-0008UR-V8 for submit@debbugs.gnu.org; Sat, 22 Feb 2025 04:56:43 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:41158) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tlmFT-0008TC-Jz for 74771@debbugs.gnu.org; Sat, 22 Feb 2025 04:56:40 -0500 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 1tlmFN-0008IW-Kf; Sat, 22 Feb 2025 04:56:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=CecdG0sF2FrC4QXrED8LNDk1du85kgrCwKZEO7AWQSQ=; b=BqToSumoNnr0CJy5pj1R 3xDHjlb0q5UnCLMYnb684mT+Ce3JoaOw4LHF5RgKvH4Ro4gHK1a/byIINkRI0dg/zgK33JN/NBvMo If5Tr+W2CjCGXvg9JeINiXgHEG0KekTQzn7W7iph5vgW1cg6vgeR8ayPHx51SQSh18rIiUiNjc1WF U+3kiTWKst+0ExdxjdFmpEaQH3BZkdp7GrXtk8kMinM4fBhQ0jNGvgNXmVWED/djlZi8C0RuAyjq/ abH0Gb6dAxbfRu9uTNK4tt6rY8zbBy/vtMgOIl7yTPXzNeTF3BsTE9HJVxj1pwt5u77Ca/F5PcV8W DXNPRTvo1yVVQw==; Date: Sat, 22 Feb 2025 11:56:25 +0200 Message-Id: <86jz9ijoae.fsf@gnu.org> From: Eli Zaretskii To: acorallo@gnu.org, Pip Cet In-Reply-To: <871pxdfrrr.fsf@protonmail.com> (message from Pip Cet on Wed, 08 Jan 2025 11:51:07 +0000) Subject: Re: bug#74771: Native compilation bug with struct predicates when lexical binding enabled (HEAD) References: <0446a656-1fa2-4160-a8ba-69c060a52589@risk-engineering.org> <865xn4ul9t.fsf@gnu.org> <871pxdfrrr.fsf@protonmail.com> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 74771 Cc: eric.marsden@risk-engineering.org, 74771@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Ping! Can we make progress here, please? > Date: Wed, 08 Jan 2025 11:51:07 +0000 > From: Pip Cet > Cc: Eli Zaretskii , 74771@debbugs.gnu.org, eric.marsden@risk-engineering.org > > "Andrea Corallo" writes: > > > Eli Zaretskii writes: > > > >>> Cc: 74771@debbugs.gnu.org > >>> From: Andrea Corallo > >>> Date: Wed, 11 Dec 2024 17:29:34 -0500 > >>> > >>> Eric Marsden writes: > >>> > >>> > Hi, > >>> > > >>> > With the attached source file, Emacs miscompiles the struct predicate such > >>> > that a repeated call to the predicate on a non-struct object returns t. > >>> > This occurs with current HEAD on Linux/AMD64, but not on the Emacs 30.0.92 > >>> > pretest. It does not occur when the lexical binding cookie is not present. > >>> > > >>> > % /opt/emacs/bin/emacs -Q --batch --eval "(load (native-compile \"/tmp/bug.el\"))" -f run > >>> > Loading /home/emarsden/.emacs.d/eln-cache/31.0.50-c021c983/bug-59c4b27c-c70072f9.eln (native compiled elisp)... > >>> > Running in GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.43, cairo version 1.18.2) > >>> >  of 2024-12-09 > >>> > is? nil > >>> > is? t   ;; expecting nil > >>> > bar: 111 > >>> > > >>> > ;;; -*- lexical-binding: t -*- > >>> > ;; > >>> > ;; /opt/emacs/bin/emacs -Q --batch -L . --eval "(load (native-compile \"/tmp/bug.el\"))" -f run > >>> > > >>> > (require 'cl-lib) > >>> > > >>> > (cl-defstruct foobles bar baz) > >>> > > >>> > (defun bug (foo) > >>> > (message "is? %s" (foobles-p foo)) > >>> > (message "is? %s" (foobles-p foo)) > >>> > (message "bar: %s" (foobles-bar foo))) > >>> > > >>> > (defun run () > >>> > (message "Running in %s" (version)) > >>> > (let ((foo "foo")) > >>> > (bug foo))) > >>> > >>> Hi Eric, > >>> > >>> thanks for the report, I'll look at this in the coming days. > >> > >> Any progress here? > > > > Not so far, I'm on holiday this days so I don't have much time for > > coding, it's in my todo list tho. > > No activity in a while, so I tried reproducing this: bug's still there. > > Can you repeat for me what > > (assume #s(comp-mvar (t) nil nil nil nil nil) (not #s(comp-mvar (foobles) nil nil nil nil nil))) > > is supposed to mean? > > To me, it appears to mean "the value of the first mvar is different from > the value of the second mvar, which is of type foobles". This doesn't > say anything about the type of the first mvar, assuming there is more > than one value of the foobles type; if this is the correct > interpretation, we need to stop copying the typeset in this case: > > diff --git a/lisp/emacs-lisp/comp-cstr.el b/lisp/emacs-lisp/comp-cstr.el > index 3d46cc8c6ae..5d87ff75703 100644 > --- a/lisp/emacs-lisp/comp-cstr.el > +++ b/lisp/emacs-lisp/comp-cstr.el > @@ -1176,14 +1176,11 @@ comp-cstr-value-negation > "Negate values in SRC setting the result in DST. > DST is returned." > (with-comp-cstr-accessors > - (if (or (valset src) (range src)) > - (setf (typeset dst) () > - (valset dst) (valset src) > - (range dst) (range src) > - (neg dst) (not (neg src))) > - (setf (typeset dst) (typeset src) > - (valset dst) () > - (range dst) ())) > + (and (or (valset src) (range src)) > + (setf (typeset dst) () > + (valset dst) (valset src) > + (range dst) (range src) > + (neg dst) (not (neg src)))) > dst)) > > (defun comp-cstr-negation-make (src) > > > I see two other possibilities: > > 1. it means the lhs mvar is of type "foobles", but not identical to the > second mvar. This is what comp-cstr-negation-make currently assumes. > In this case, comp--add-cond-cstrs should not be emitting this > pseudo-insn for the case in which the lhs mvar is known not to be of > type "foobles", but nothing else is known about its value: > > diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el > index 269eae315e4..d5c512fbdc3 100644 > --- a/lisp/emacs-lisp/comp.el > +++ b/lisp/emacs-lisp/comp.el > @@ -2033,11 +2033,7 @@ comp--add-cond-cstrs > (comp--emit-assume 'and mvar-tested > (make--comp-mvar :type (comp-cstr-cl-tag mvar-tag)) > (comp--add-cond-cstrs-target-block b bb2) > - nil) > - (comp--emit-assume 'and mvar-tested > - (make--comp-mvar :type (comp-cstr-cl-tag mvar-tag)) > - (comp--add-cond-cstrs-target-block b bb1) > - t)) > + nil)) > (`((set ,(and (pred comp-mvar-p) cmp-res) > (,(pred comp--call-op-p) > ,(and (or (pred comp--equality-fun-p) > > 2. it means the lhs mvar is not of type "foobles". In this case, > comp-cstr-value-negation should make the lhs mvar have a negated cstr > with type "foobles": > > diff --git a/lisp/emacs-lisp/comp-cstr.el b/lisp/emacs-lisp/comp-cstr.el > index 3d46cc8c6ae..03a00123f64 100644 > --- a/lisp/emacs-lisp/comp-cstr.el > +++ b/lisp/emacs-lisp/comp-cstr.el > @@ -1183,7 +1183,8 @@ comp-cstr-value-negation > (neg dst) (not (neg src))) > (setf (typeset dst) (typeset src) > (valset dst) () > - (range dst) ())) > + (range dst) () > + (neg dst) (not (neg src)))) > dst)) > > (defun comp-cstr-negation-make (src) > > Note that if (2) is intended, that is a really strange interpretation of > what "not" means: it's negating a cstr (a set of values), not an mvar (a > specific value), so why is the argument an mvar? We could make this > change, and then try to recover whichever optimizations that disables: > > diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el > index 269eae315e4..bcc0628235a 100644 > --- a/lisp/emacs-lisp/comp.el > +++ b/lisp/emacs-lisp/comp.el > @@ -2035,7 +2035,7 @@ comp--add-cond-cstrs > (comp--add-cond-cstrs-target-block b bb2) > nil) > (comp--emit-assume 'and mvar-tested > - (make--comp-mvar :type (comp-cstr-cl-tag mvar-tag)) > + (comp--type-to-cstr (comp-cstr-cl-tag mvar-tag)) > (comp--add-cond-cstrs-target-block b bb1) > t)) > (`((set ,(and (pred comp-mvar-p) cmp-res) > > In any case, please consider documenting the pseudo-insns. > not-eq-to-mvar and not-matching-cstr are two very different things! > > Pip > > From debbugs-submit-bounces@debbugs.gnu.org Sun Mar 09 05:00:30 2025 Received: (at 74771) by debbugs.gnu.org; 9 Mar 2025 09:00:30 +0000 Received: from localhost ([127.0.0.1]:58201 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1trCWL-0003BH-Bu for submit@debbugs.gnu.org; Sun, 09 Mar 2025 05:00:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59846) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1trCWI-0003B4-Qg for 74771@debbugs.gnu.org; Sun, 09 Mar 2025 05:00:27 -0400 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 1trCWB-0000kC-Os; Sun, 09 Mar 2025 05:00:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=6qtSMBEYWXCyqrNOvGIIaCyqe94yb/8TLIrMYyEcos0=; b=N8IJVhkCBJRuwMW4IIHP S01PkrP7+1uDO84DnyABl1+QXD5+x/iMco4rRkP+6QrTRaxP8gT2+HfRzvYpHTB1iC7U4doEuYtfF hjH5kPE/qIYDZ9nph0RXCLrrh85ceI4nuHbqjWu98+I41U+bcthr/PDKo+yv6upC9Jjp8Cyb2Z8xe 0wwV5Kk7AeIo883/NUMdHkRFNUgDtDgkZAJRJlRzSoipmBv0lHCoXaEUtfJcmYdzAD62+1eQNZBef 5dwi6BRG8XBOwSRSMBestnFsknK7jXKGnf2zJGgrjVQtxLkzQOQLtXiHknzIquMgJRddEsPtZar6B yey9tb/iFFnEaA==; Date: Sun, 09 Mar 2025 11:00:16 +0200 Message-Id: <86wmcyh93z.fsf@gnu.org> From: Eli Zaretskii To: acorallo@gnu.org, pipcet@protonmail.com In-Reply-To: <86jz9ijoae.fsf@gnu.org> (message from Eli Zaretskii on Sat, 22 Feb 2025 11:56:25 +0200) Subject: Re: bug#74771: Native compilation bug with struct predicates when lexical binding enabled (HEAD) References: <0446a656-1fa2-4160-a8ba-69c060a52589@risk-engineering.org> <865xn4ul9t.fsf@gnu.org> <871pxdfrrr.fsf@protonmail.com> <86jz9ijoae.fsf@gnu.org> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 74771 Cc: 74771@debbugs.gnu.org, eric.marsden@risk-engineering.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Ping! Ping! Andrea, could you please respond? > Cc: eric.marsden@risk-engineering.org, 74771@debbugs.gnu.org > Date: Sat, 22 Feb 2025 11:56:25 +0200 > From: Eli Zaretskii > > Ping! Can we make progress here, please? > > > Date: Wed, 08 Jan 2025 11:51:07 +0000 > > From: Pip Cet > > Cc: Eli Zaretskii , 74771@debbugs.gnu.org, eric.marsden@risk-engineering.org > > > > "Andrea Corallo" writes: > > > > > Eli Zaretskii writes: > > > > > >>> Cc: 74771@debbugs.gnu.org > > >>> From: Andrea Corallo > > >>> Date: Wed, 11 Dec 2024 17:29:34 -0500 > > >>> > > >>> Eric Marsden writes: > > >>> > > >>> > Hi, > > >>> > > > >>> > With the attached source file, Emacs miscompiles the struct predicate such > > >>> > that a repeated call to the predicate on a non-struct object returns t. > > >>> > This occurs with current HEAD on Linux/AMD64, but not on the Emacs 30.0.92 > > >>> > pretest. It does not occur when the lexical binding cookie is not present. > > >>> > > > >>> > % /opt/emacs/bin/emacs -Q --batch --eval "(load (native-compile \"/tmp/bug.el\"))" -f run > > >>> > Loading /home/emarsden/.emacs.d/eln-cache/31.0.50-c021c983/bug-59c4b27c-c70072f9.eln (native compiled elisp)... > > >>> > Running in GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.43, cairo version 1.18.2) > > >>> >  of 2024-12-09 > > >>> > is? nil > > >>> > is? t   ;; expecting nil > > >>> > bar: 111 > > >>> > > > >>> > ;;; -*- lexical-binding: t -*- > > >>> > ;; > > >>> > ;; /opt/emacs/bin/emacs -Q --batch -L . --eval "(load (native-compile \"/tmp/bug.el\"))" -f run > > >>> > > > >>> > (require 'cl-lib) > > >>> > > > >>> > (cl-defstruct foobles bar baz) > > >>> > > > >>> > (defun bug (foo) > > >>> > (message "is? %s" (foobles-p foo)) > > >>> > (message "is? %s" (foobles-p foo)) > > >>> > (message "bar: %s" (foobles-bar foo))) > > >>> > > > >>> > (defun run () > > >>> > (message "Running in %s" (version)) > > >>> > (let ((foo "foo")) > > >>> > (bug foo))) > > >>> > > >>> Hi Eric, > > >>> > > >>> thanks for the report, I'll look at this in the coming days. > > >> > > >> Any progress here? > > > > > > Not so far, I'm on holiday this days so I don't have much time for > > > coding, it's in my todo list tho. > > > > No activity in a while, so I tried reproducing this: bug's still there. > > > > Can you repeat for me what > > > > (assume #s(comp-mvar (t) nil nil nil nil nil) (not #s(comp-mvar (foobles) nil nil nil nil nil))) > > > > is supposed to mean? > > > > To me, it appears to mean "the value of the first mvar is different from > > the value of the second mvar, which is of type foobles". This doesn't > > say anything about the type of the first mvar, assuming there is more > > than one value of the foobles type; if this is the correct > > interpretation, we need to stop copying the typeset in this case: > > > > diff --git a/lisp/emacs-lisp/comp-cstr.el b/lisp/emacs-lisp/comp-cstr.el > > index 3d46cc8c6ae..5d87ff75703 100644 > > --- a/lisp/emacs-lisp/comp-cstr.el > > +++ b/lisp/emacs-lisp/comp-cstr.el > > @@ -1176,14 +1176,11 @@ comp-cstr-value-negation > > "Negate values in SRC setting the result in DST. > > DST is returned." > > (with-comp-cstr-accessors > > - (if (or (valset src) (range src)) > > - (setf (typeset dst) () > > - (valset dst) (valset src) > > - (range dst) (range src) > > - (neg dst) (not (neg src))) > > - (setf (typeset dst) (typeset src) > > - (valset dst) () > > - (range dst) ())) > > + (and (or (valset src) (range src)) > > + (setf (typeset dst) () > > + (valset dst) (valset src) > > + (range dst) (range src) > > + (neg dst) (not (neg src)))) > > dst)) > > > > (defun comp-cstr-negation-make (src) > > > > > > I see two other possibilities: > > > > 1. it means the lhs mvar is of type "foobles", but not identical to the > > second mvar. This is what comp-cstr-negation-make currently assumes. > > In this case, comp--add-cond-cstrs should not be emitting this > > pseudo-insn for the case in which the lhs mvar is known not to be of > > type "foobles", but nothing else is known about its value: > > > > diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el > > index 269eae315e4..d5c512fbdc3 100644 > > --- a/lisp/emacs-lisp/comp.el > > +++ b/lisp/emacs-lisp/comp.el > > @@ -2033,11 +2033,7 @@ comp--add-cond-cstrs > > (comp--emit-assume 'and mvar-tested > > (make--comp-mvar :type (comp-cstr-cl-tag mvar-tag)) > > (comp--add-cond-cstrs-target-block b bb2) > > - nil) > > - (comp--emit-assume 'and mvar-tested > > - (make--comp-mvar :type (comp-cstr-cl-tag mvar-tag)) > > - (comp--add-cond-cstrs-target-block b bb1) > > - t)) > > + nil)) > > (`((set ,(and (pred comp-mvar-p) cmp-res) > > (,(pred comp--call-op-p) > > ,(and (or (pred comp--equality-fun-p) > > > > 2. it means the lhs mvar is not of type "foobles". In this case, > > comp-cstr-value-negation should make the lhs mvar have a negated cstr > > with type "foobles": > > > > diff --git a/lisp/emacs-lisp/comp-cstr.el b/lisp/emacs-lisp/comp-cstr.el > > index 3d46cc8c6ae..03a00123f64 100644 > > --- a/lisp/emacs-lisp/comp-cstr.el > > +++ b/lisp/emacs-lisp/comp-cstr.el > > @@ -1183,7 +1183,8 @@ comp-cstr-value-negation > > (neg dst) (not (neg src))) > > (setf (typeset dst) (typeset src) > > (valset dst) () > > - (range dst) ())) > > + (range dst) () > > + (neg dst) (not (neg src)))) > > dst)) > > > > (defun comp-cstr-negation-make (src) > > > > Note that if (2) is intended, that is a really strange interpretation of > > what "not" means: it's negating a cstr (a set of values), not an mvar (a > > specific value), so why is the argument an mvar? We could make this > > change, and then try to recover whichever optimizations that disables: > > > > diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el > > index 269eae315e4..bcc0628235a 100644 > > --- a/lisp/emacs-lisp/comp.el > > +++ b/lisp/emacs-lisp/comp.el > > @@ -2035,7 +2035,7 @@ comp--add-cond-cstrs > > (comp--add-cond-cstrs-target-block b bb2) > > nil) > > (comp--emit-assume 'and mvar-tested > > - (make--comp-mvar :type (comp-cstr-cl-tag mvar-tag)) > > + (comp--type-to-cstr (comp-cstr-cl-tag mvar-tag)) > > (comp--add-cond-cstrs-target-block b bb1) > > t)) > > (`((set ,(and (pred comp-mvar-p) cmp-res) > > > > In any case, please consider documenting the pseudo-insns. > > not-eq-to-mvar and not-matching-cstr are two very different things! > > > > Pip > > > > > > > > From debbugs-submit-bounces@debbugs.gnu.org Sat Mar 15 08:00:14 2025 Received: (at 74771) by debbugs.gnu.org; 15 Mar 2025 12:00:14 +0000 Received: from localhost ([127.0.0.1]:39407 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ttQBZ-00086T-TY for submit@debbugs.gnu.org; Sat, 15 Mar 2025 08:00:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48458) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ttQBX-0007zy-5i for 74771@debbugs.gnu.org; Sat, 15 Mar 2025 08:00:11 -0400 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 1ttQBQ-0004Gj-Jn; Sat, 15 Mar 2025 08:00:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=55TAG+nYnSy8wPRPliYWdMUUAqkL7oq4DfZOo5uYLZg=; b=ZPbOxI/0y5ANg/4Y6BKw 3C4jDfER8pzsuydj8UpBs+K4wJaJGAidYVVdsLeEyklqWYYW9Z1diFd+gJnJdZhqa3oZPxbNQTG2R uzMrK3EtyAB8VwtsoMJ4ghY5bb5RVR3EokNajIAL/lEcyF2TjXJAU87ofomEZiI3tKlQWV3a8M89U JBTAQzWHlUr2BfAcmVR0r7raKx6OpBXHcau6PRUwmdICPawNe6/dqi0HNkCfbswVX6M0GoJsYTYGK 1kdvLKvSSptMmggnMyXf76crNqyJPtcgxRbViXOPoQecuveDg2gabXZT2rBMM5eqvdDhV1r0XhsFu F2PR+TGVPYDfMA==; Received: from acorallo by fencepost.gnu.org with local (Exim 4.90_1) (envelope-from ) id 1ttQBL-00045W-K0; Sat, 15 Mar 2025 08:00:00 -0400 From: Andrea Corallo To: Eli Zaretskii Subject: Re: bug#74771: Native compilation bug with struct predicates when lexical binding enabled (HEAD) In-Reply-To: <86wmcyh93z.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 09 Mar 2025 11:00:16 +0200") References: <0446a656-1fa2-4160-a8ba-69c060a52589@risk-engineering.org> <865xn4ul9t.fsf@gnu.org> <871pxdfrrr.fsf@protonmail.com> <86jz9ijoae.fsf@gnu.org> <86wmcyh93z.fsf@gnu.org> Date: Sat, 15 Mar 2025 07:59:59 -0400 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 74771 Cc: pipcet@protonmail.com, 74771@debbugs.gnu.org, eric.marsden@risk-engineering.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Eli Zaretskii writes: > Ping! Ping! Andrea, could you please respond? My weekend is dedicated to this, I'm working on this and will post my findings. Andrea From debbugs-submit-bounces@debbugs.gnu.org Sun Mar 16 18:17:08 2025 Received: (at 74771) by debbugs.gnu.org; 16 Mar 2025 22:17:08 +0000 Received: from localhost ([127.0.0.1]:51119 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ttwI6-0004Oa-DG for submit@debbugs.gnu.org; Sun, 16 Mar 2025 18:17:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36046) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ttwI2-0004NA-Is for 74771@debbugs.gnu.org; Sun, 16 Mar 2025 18:17:03 -0400 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 1ttwHw-0007K5-7i; Sun, 16 Mar 2025 18:16:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=daJ6h4UnrluGFZfbCC+tdOYB1ZBMI5ZwpLHfTEonT/U=; b=fVSoJYA0F4MpqvlGKugs wX8HIChsTjmOkw9v7ug0+1A1HegdYSlvK0ryL53TgKUwXKxjRyhaYyR8lCw/WxPklqVHt9QeRLShw kFJ7ilIHHFSAXk+s4Sxlt+GNnYnuYz5ym3a/hcTi0BWmyWjCx6TWC5eqxTeBakYUyu6MVrOLP49sB uHWJQkg/2azB708m1xdlrCQZNVQOiPIGIqFrYqqFoYVGLyUT6YKuZpBb1JlqmEKCwm+yMs+DsMoDh ITYypoEOVogk78ZxUld0n3X+HPSl3DuWv5K8ZRz7KoqUqGqQ1xELomvId+wCvGhBoXCV6FDSaJTwq bc/YDytRY2wPxg==; Received: from acorallo by fencepost.gnu.org with local (Exim 4.90_1) (envelope-from ) id 1ttwHv-00044m-2Y; Sun, 16 Mar 2025 18:16:55 -0400 From: Andrea Corallo To: Eli Zaretskii Subject: Re: bug#74771: Native compilation bug with struct predicates when lexical binding enabled (HEAD) In-Reply-To: (Andrea Corallo's message of "Sat, 15 Mar 2025 07:59:59 -0400") References: <0446a656-1fa2-4160-a8ba-69c060a52589@risk-engineering.org> <865xn4ul9t.fsf@gnu.org> <871pxdfrrr.fsf@protonmail.com> <86jz9ijoae.fsf@gnu.org> <86wmcyh93z.fsf@gnu.org> Date: Sun, 16 Mar 2025 18:16:54 -0400 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 74771 Cc: pipcet@protonmail.com, eric.marsden@risk-engineering.org, 74771@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Andrea Corallo writes: > Eli Zaretskii writes: > >> Ping! Ping! Andrea, could you please respond? > > My weekend is dedicated to this, I'm working on this and will post my > findings. I did some progesses as I've a patch that fixes the reported bug. It passes all tests but unfortuantelly it breaks bootstrap as one function of comp.el gets misscompiled. I'll put more work this week to understand the cause of it. Andrea From debbugs-submit-bounces@debbugs.gnu.org Sun Mar 23 12:38:07 2025 Received: (at 74771) by debbugs.gnu.org; 23 Mar 2025 16:38:07 +0000 Received: from localhost ([127.0.0.1]:52223 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1twOKs-0007OC-03 for submit@debbugs.gnu.org; Sun, 23 Mar 2025 12:38:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48866) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1twOKo-0007NU-3X for 74771@debbugs.gnu.org; Sun, 23 Mar 2025 12:38:03 -0400 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 1twOKh-0004Ms-TT; Sun, 23 Mar 2025 12:37:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=YlS1JxI7I3fRPWttBzX9/pAZe8qsLywzu06A4qPieuk=; b=WI+DabUn1FD7JDlMnEO5 8rp8Fbfmj6S0Eg3uyW3ST52Tva4FtxTYrf3RA5gheNGpEo0LNFNq3Zz82qCFelo7uL5x27lXY/2os qByCDRxUOGwSRjMLYaM/MU72vuvAByJqtTjZKmuKDCpwP7V+xhbsb7HYrsjxb5oxsQg4vIwcf/Cjk i6V+W8i/uIKF1fJdendUYxdncH26LgRqdyZJk9vD1n+SXDGjiTRmxpULAi7A5x07gI3OeSHgX163q EkZ2vwzU2HzBubkdqIhJbuO2rCDsCon7ttjSKlMjSci18EDNHYDvdx0yEw9zQuGVpAeCkEzWGX4cB zsjLGQjI4zLZ+w==; Received: from acorallo by fencepost.gnu.org with local (Exim 4.90_1) (envelope-from ) id 1twOKc-0004VC-NS; Sun, 23 Mar 2025 12:37:54 -0400 From: Andrea Corallo To: Eric Marsden Subject: Re: bug#74771: Native compilation bug with struct predicates when lexical binding enabled (HEAD) In-Reply-To: <0446a656-1fa2-4160-a8ba-69c060a52589@risk-engineering.org> (Eric Marsden's message of "Tue, 10 Dec 2024 17:55:46 +0100") References: <0446a656-1fa2-4160-a8ba-69c060a52589@risk-engineering.org> Date: Sun, 23 Mar 2025 12:37:50 -0400 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 74771 Cc: 74771@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Eric Marsden writes: > Hi, > > With the attached source file, Emacs miscompiles the struct predicate such > that a repeated call to the predicate on a non-struct object returns t. > This occurs with current HEAD on Linux/AMD64, but not on the Emacs 30.0.92 > pretest. It does not occur when the lexical binding cookie is not present. > > % /opt/emacs/bin/emacs -Q --batch --eval "(load (native-compile \"/tmp/bu= g.el\"))" -f run > Loading /home/emarsden/.emacs.d/eln-cache/31.0.50-c021c983/bug-59c4b27c-c= 70072f9.eln (native compiled elisp)... > Running in GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version = 3.24.43, cairo version 1.18.2) > =C2=A0of 2024-12-09 > is? nil > is? t=C2=A0=C2=A0 ;; expecting nil > bar: 111 Hi Eric, could you try with d565a6747a2, seems to work for me. I'll want to do more work in this area anyway this fixes the issue now. Thanks Andrea From debbugs-submit-bounces@debbugs.gnu.org Mon Mar 24 04:58:21 2025 Received: (at 74771) by debbugs.gnu.org; 24 Mar 2025 08:58:21 +0000 Received: from localhost ([127.0.0.1]:54176 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1twddV-0001Zl-5T for submit@debbugs.gnu.org; Mon, 24 Mar 2025 04:58:21 -0400 Received: from mail.risk-engineering.org ([2a01:4f8:c0c:a3f8::1]:34196) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1twddS-0001Zb-LC for 74771@debbugs.gnu.org; Mon, 24 Mar 2025 04:58:19 -0400 DKIM-Signature: a=rsa-sha256; bh=LiEuKp8VHJiU4pxkMymo1cXNvOmsV6ipjFMqzvD+Lb8=; c=relaxed/relaxed; d=risk-engineering.org; h=Subject:Subject:Sender:To:To:Cc:Cc:From:From:Date:Date:MIME-Version:MIME-Version:Content-Type:Content-Type:Content-Transfer-Encoding:Content-Transfer-Encoding:Reply-To:In-Reply-To:In-Reply-To:Message-Id:Message-Id:References:References:Autocrypt:Openpgp; i=@risk-engineering.org; s=default; t=1742806692; v=1; x=1743238692; b=cgLT5HDhTCZ7K2JSvoD7i0F5s7RGNfqZkqixXZgJ+hfhI44Jf+uiU5GdKxjUCDxvz2N6Fw0R Qyo+/ktQE8Fdu7nIlIlSCOh4WYxEI/W0RaZOs25qQJ1arEkDC6LKph1x1r8PVvWYOeVOpik9Sla +4Nx3f0MgXIId9YIzrq+Lvaa4u2npLhkTlq9UTdQAOMh9k6tZK7uw4Y5uaLi146mnKMa4c7Dx1j z2sD0eUzb1DtksYNGLOJUQCjPnU9kdl6pAA3Dj4E0/MaeDUEVJVxxzzz/hwBC0uLgf8ceayHruS sX202ksXLle8yeG4yyWky6/82xHvJCDIwVadJM9cjxgNg== Received: by mail.risk-engineering.org (envelope-sender ) with ESMTPS id a77592e8; Mon, 24 Mar 2025 09:58:12 +0100 Message-ID: Date: Mon, 24 Mar 2025 09:58:09 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: bug#74771: Native compilation bug with struct predicates when lexical binding enabled (HEAD) To: Andrea Corallo References: <0446a656-1fa2-4160-a8ba-69c060a52589@risk-engineering.org> Content-Language: en-US From: Eric Marsden In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 74771 Cc: 74771@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On 23/03/2025 17:37, Andrea Corallo wrote: > Eric Marsden writes: > >> With the attached source file, Emacs miscompiles the struct predicate such >> that a repeated call to the predicate on a non-struct object returns t. >> This occurs with current HEAD on Linux/AMD64, but not on the Emacs 30.0.92 >> pretest. It does not occur when the lexical binding cookie is not present. >> >> % /opt/emacs/bin/emacs -Q --batch --eval "(load (native-compile \"/tmp/bug.el\"))" -f run >> Loading /home/emarsden/.emacs.d/eln-cache/31.0.50-c021c983/bug-59c4b27c-c70072f9.eln (native compiled elisp)... >> Running in GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.43, cairo version 1.18.2) >>  of 2024-12-09 >> is? nil >> is? t   ;; expecting nil >> bar: 111 > Hi Eric, > > could you try with d565a6747a2, seems to work for me. I'll want to do > more work in this area anyway this fixes the issue now. Hello, I tested with current HEAD (0cfe700e336) which resolves the problem, also on my full application. Thanks! Eric From debbugs-submit-bounces@debbugs.gnu.org Mon Mar 24 16:27:10 2025 Received: (at 74771-done) by debbugs.gnu.org; 24 Mar 2025 20:27:10 +0000 Received: from localhost ([127.0.0.1]:59220 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1twoO6-0005kE-2i for submit@debbugs.gnu.org; Mon, 24 Mar 2025 16:27:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44308) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1twoO3-0005jy-Ee for 74771-done@debbugs.gnu.org; Mon, 24 Mar 2025 16:27:07 -0400 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 1twoNx-0005cX-FC; Mon, 24 Mar 2025 16:27:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=18xMschzcy92K73gbIPVPSHD/RMxCqZf7O5CmCaRyxA=; b=HWBsrm4iYm4yFjl04PDG VEV+AxfR7pDGP8raaMJqpxd098cQifM30+TUuyo9xTcvBkooO/1ORkPjf+acfMtoLopelUxvi5JZM gbjs/Wyi8lxuA00P2pEg/I+78xeOS/upX4H6SjuIMnxMZQ7+6kGi1HWudVtZK8eI5MM/2+5A2pLVw 1SCqHJ2ULLZMdOShDw/0EDLnwIZXOdlobQGywh+AiaAZmGZXZ6tfI5y1jJ6gp9ppRia1COE8IurqM dN9C383zHB1uRmGxFlsmMwqc9xibDR32GbfpWbiSZU9gkVE+xMd7dJIfT2GNLvpAymydk24g+2uU6 60tKu+WXqQ4RVg==; Received: from acorallo by fencepost.gnu.org with local (Exim 4.90_1) (envelope-from ) id 1twoNt-0006HX-Cm; Mon, 24 Mar 2025 16:27:00 -0400 From: Andrea Corallo To: Eric Marsden Subject: Re: bug#74771: Native compilation bug with struct predicates when lexical binding enabled (HEAD) In-Reply-To: (Eric Marsden's message of "Mon, 24 Mar 2025 09:58:09 +0100") References: <0446a656-1fa2-4160-a8ba-69c060a52589@risk-engineering.org> Date: Mon, 24 Mar 2025 16:26:57 -0400 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 74771-done Cc: 74771-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Eric Marsden writes: > On 23/03/2025 17:37, Andrea Corallo wrote: >> Eric Marsden writes: >> >>> With the attached source file, Emacs miscompiles the struct predicate s= uch >>> that a repeated call to the predicate on a non-struct object returns t. >>> This occurs with current HEAD on Linux/AMD64, but not on the Emacs 30.0= .92 >>> pretest. It does not occur when the lexical binding cookie is not prese= nt. >>> >>> % /opt/emacs/bin/emacs -Q --batch --eval "(load (native-compile \"/tmp/= bug.el\"))" -f run >>> Loading /home/emarsden/.emacs.d/eln-cache/31.0.50-c021c983/bug-59c4b27c= -c70072f9.eln (native compiled elisp)... >>> Running in GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Versio= n 3.24.43, cairo version 1.18.2) >>> =C2=A0of 2024-12-09 >>> is? nil >>> is? t=C2=A0=C2=A0 ;; expecting nil >>> bar: 111 >> Hi Eric, >> >> could you try with d565a6747a2, seems to work for me. I'll want to do >> more work in this area anyway this fixes the issue now. > > Hello, > > I tested with current HEAD (0cfe700e336) which resolves the problem, also= on my full application. Thanks! > > Eric Cool, closing then. Thanks for the good report and sorry for the wait. Andrea From unknown Sun Jun 22 07:37:47 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Tue, 22 Apr 2025 11:24:16 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator