Received: (at 64508) by debbugs.gnu.org; 4 Mar 2026 19:45:24 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Mar 04 14:45:23 2026
Received: from localhost ([127.0.0.1]:36154 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1vxs9q-0000hx-Pu
for submit <at> debbugs.gnu.org; Wed, 04 Mar 2026 14:45:23 -0500
Received: from smtp.polymtl.ca ([132.207.4.11]:33413)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <olivier.dion@HIDDEN>)
id 1vxs9n-0000T1-W9
for 64508 <at> debbugs.gnu.org; Wed, 04 Mar 2026 14:45:20 -0500
Received: from localhost (199-193-172-8.cpe.axion.ca [199.193.172.8])
by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 624JixGf104254;
Wed, 4 Mar 2026 14:45:04 -0500
DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 624JixGf104254
From: Olivier Dion <olivier.dion@HIDDEN>
To: Werner LEMBERG <wl@HIDDEN>, Jean Abou Samra <jean@HIDDEN>,
64508 <at> debbugs.gnu.org
Subject: Re: Optimization of "-" function is incorrect in presence of GOOPS
overloading
In-Reply-To: <871phz7fo6.fsf@laura>
References: <20260304.152706.41606917557333894.wl@HIDDEN>
<871phz7fo6.fsf@laura>
Date: Wed, 04 Mar 2026 14:44:59 -0500
Message-ID: <87wlzr5qh0.fsf@laura>
MIME-Version: 1.0
Content-Type: text/plain
X-Poly-FromMTA: (199-193-172-8.cpe.axion.ca [199.193.172.8]) at Wed,
4 Mar 2026 19:44:59 +0000
X-Spam-Score: -0.2 (/)
X-Debbugs-Envelope-To: 64508
Cc: Andy Wingo <wingo@HIDDEN>,
Ludovic =?utf-8?Q?Court=C3=A8s?= <ludo@HIDDEN>,
Zhu Zihao <all_but_last@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.2 (-)
On Wed, 04 Mar 2026, Olivier Dion <olivier.dion@HIDDEN> wrote:
> On Wed, 04 Mar 2026, Werner LEMBERG <wl@HIDDEN> wrote:
>> Is there any progress in fixing this glitch?
[...]
> To something is happening when expanding: (primcall - (toplevel x))
So the culprit is in languages/tree-il/primitives.scm:
(define-primitive-expander -
(x) (- 0 x) ; <- here
(x y) (- x y)
(x y z ... last) (- (- x y . z) last))
introduced by cb28c08537790b49f7bc94f2f6b426497152bbe7
If I remove the 0, it seems to be okay and no tests are failing. I
wonder why Andy decides to put this expansion.
There seems to be similar expansions for a couple of primitive generics:
(define-primitive-expander zero? (x)
(= x 0))
(define-primitive-expander positive? (x)
(> x 0))
(define-primitive-expander negative? (x)
(< x 0))
(define-primitive-expander /
(x) (/ 1 x) ; <- here
(x y z ... last) (/ (/ x y . z) last))
I think it is fine to remove the expander for the `(x)' case for `-' and
`/', but not for the predicates. Thoughts?
Thanks,
Olivier
--
Olivier Dion
bug-guile@HIDDEN:bug#64508; Package guile.
Full text available.Received: (at 64508) by debbugs.gnu.org; 4 Mar 2026 15:55:39 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Wed Mar 04 10:55:39 2026 Received: from localhost ([127.0.0.1]:34188 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1vxoZW-0002RD-RF for submit <at> debbugs.gnu.org; Wed, 04 Mar 2026 10:55:39 -0500 Received: from smtp.polymtl.ca ([132.207.4.11]:48828) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <olivier.dion@HIDDEN>) id 1vxoZU-0002Qi-4y for 64508 <at> debbugs.gnu.org; Wed, 04 Mar 2026 10:55:36 -0500 Received: from localhost (199-193-172-8.cpe.axion.ca [199.193.172.8]) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 624FtLr7035433; Wed, 4 Mar 2026 10:55:25 -0500 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 624FtLr7035433 From: Olivier Dion <olivier.dion@HIDDEN> To: Werner LEMBERG <wl@HIDDEN>, Jean Abou Samra <jean@HIDDEN>, 64508 <at> debbugs.gnu.org Subject: Re: Optimization of "-" function is incorrect in presence of GOOPS overloading In-Reply-To: <20260304.152706.41606917557333894.wl@HIDDEN> References: <20260304.152706.41606917557333894.wl@HIDDEN> Date: Wed, 04 Mar 2026 10:55:21 -0500 Message-ID: <871phz7fo6.fsf@laura> MIME-Version: 1.0 Content-Type: text/plain X-Poly-FromMTA: (199-193-172-8.cpe.axion.ca [199.193.172.8]) at Wed, 4 Mar 2026 15:55:21 +0000 X-Spam-Score: -0.2 (/) X-Debbugs-Envelope-To: 64508 X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.2 (-) On Wed, 04 Mar 2026, Werner LEMBERG <wl@HIDDEN> wrote: > Is there any progress in fixing this glitch? It seems that the combinaison of the optimization passes `#:expand-primitives?' and `#:resolve-primitives?' will always optimize the expression in a way that introduce a 0 as the second argument. With some `pk' in language/tree-il/optimize.scm: scheme@(guile-user>) ,option optimization-level 1 scheme@(guile-user>) ,optimize (- x ) ... ;;; (starting-pass #<procedure resolve-primitives (x mod)>) ;;; (before #<tree-il (call (toplevel -) (toplevel x))>) ;;; (after #<tree-il (primcall - (toplevel x))>) ;;; (starting-pass #<procedure expand-primitives (x)>) ;;; (before #<tree-il (primcall - (toplevel x))>) ;;; (after #<tree-il (primcall - (const 0) (toplevel x))>) ... To something is happening when expanding: (primcall - (toplevel x)) I'll continue digging. But looking at the intrinsics `sub', which is `scm_difference', it is fine for the second parameter to be unbound, in which case the negation of the first parameter is return or a dispatch is made when not a number. However, I think that the VM always requires two argument for the intrinsic. I guess it is a matter of changing the value of the immediate value to be the undefined value. Thanks, Olivier -- Olivier Dion
bug-guile@HIDDEN:bug#64508; Package guile.
Full text available.Received: (at 64508) by debbugs.gnu.org; 4 Mar 2026 14:27:20 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Wed Mar 04 09:27:20 2026 Received: from localhost ([127.0.0.1]:33209 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1vxnC3-0001Aq-Ox for submit <at> debbugs.gnu.org; Wed, 04 Mar 2026 09:27:20 -0500 Received: from mout02.posteo.de ([185.67.36.66]:44209) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <werner.lemberg@HIDDEN>) id 1vxnC1-0001AV-On for 64508 <at> debbugs.gnu.org; Wed, 04 Mar 2026 09:27:18 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 5BFBA240104 for <64508 <at> debbugs.gnu.org>; Wed, 4 Mar 2026 15:27:11 +0100 (CET) Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4fQw3f48PYz6v0y for <64508 <at> debbugs.gnu.org>; Wed, 4 Mar 2026 15:27:10 +0100 (CET) Date: Wed, 04 Mar 2026 14:27:10 +0000 Message-Id: <20260304.152706.41606917557333894.wl@HIDDEN> To: 64508 <at> debbugs.gnu.org From: Werner LEMBERG <wl@HIDDEN> Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam-Score: 1.4 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Is there any progress in fixing this glitch? Content analysis details: (1.4 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.3 RCVD_IN_VALIDITY_RPBL_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [185.67.36.66 listed in bl.score.senderscore.com] 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 1.1 RCVD_IN_VALIDITY_SAFE_BLOCKED RBL: ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. [185.67.36.66 listed in sa-trusted.bondedsender.org] -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [185.67.36.66 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [185.67.36.66 listed in wl.mailspike.net] 1.8 MISSING_SUBJECT Missing Subject: header 0.2 NO_SUBJECT Extra score for no subject X-Debbugs-Envelope-To: 64508 X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: 0.4 (/) Is there any progress in fixing this glitch?
bug-guile@HIDDEN:bug#64508; Package guile.
Full text available.
Received: (at submit) by debbugs.gnu.org; 7 Jul 2023 12:56:24 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jul 07 08:56:24 2023
Received: from localhost ([127.0.0.1]:42749 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1qHl0Z-0003kA-JR
for submit <at> debbugs.gnu.org; Fri, 07 Jul 2023 08:56:24 -0400
Received: from lists.gnu.org ([209.51.188.17]:39178)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <jean@HIDDEN>) id 1qHl0X-0003k2-Em
for submit <at> debbugs.gnu.org; Fri, 07 Jul 2023 08:56:22 -0400
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 <jean@HIDDEN>)
id 1qHl0X-0006Pu-8P
for bug-guile@HIDDEN; Fri, 07 Jul 2023 08:56:21 -0400
Received: from mout.kundenserver.de ([217.72.192.73])
by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.90_1) (envelope-from <jean@HIDDEN>)
id 1qHl0V-0007G8-5u
for bug-guile@HIDDEN; Fri, 07 Jul 2023 08:56:20 -0400
Received: from [10.102.140.73] ([193.190.193.4]) by mrelayeu.kundenserver.de
(mreue106 [212.227.15.184]) with ESMTPSA (Nemesis) id
1MdNHa-1pihIu1S4W-00ZQB2 for <bug-guile@HIDDEN>; Fri, 07 Jul 2023 14:56:16
+0200
Message-ID: <6f7bb96b48e6a80287b9c2f827605b4c3c5bd17b.camel@HIDDEN>
Subject: Optimization of "-" function is incorrect in presence of GOOPS
overloading
From: Jean Abou Samra <jean@HIDDEN>
To: bug-guile@HIDDEN
Date: Fri, 07 Jul 2023 14:56:15 +0200
Content-Type: multipart/signed; micalg="pgp-sha512";
protocol="application/pgp-signature"; boundary="=-/uCFF9OG9+W/ZLCTFSrm"
User-Agent: Evolution 3.48.3 (3.48.3-1.fc38)
MIME-Version: 1.0
X-Provags-ID: V03:K1:OYu8MtAUsk8MOCEJqxx3QWDiVfr5KOcLhbaJOgHR85zRczvOMcr
3xugzM/pF2gwPZV3Z8RgYJap64IYL4cORclEXlPRiCZ9YIeOQPW3h1A3ocAHqKlm4mCcCJu
u8VSZSQpiPwX4oa8AsZgT+OMhacBbNEutqVCiws+J8N+RB+I/Z4199L1AwMLxsqIAFEVlg8
7yYlzInGK6QO5M9nK0ItA==
X-Spam-Flag: NO
UI-OutboundReport: notjunk:1;M01:P0:lONT9nCFt5w=;9xpFy+kwe3hHsyBRYxHXguubg2G
rJRZILlvmwWOqEmdAvtcwMhlVMQ9cuH68I3ydRGddycNiyykDliUK+yOCjlhH8v9iK9rW5//U
dGKVXMo8znCrIqpGuQ/AQHd4CoUrqpSgQuJZAwpkypF3I/nmVXYA9d1knuI+/HHLF2kT1uw0g
yz85eqrNQwTEdAzTce/dbw1pfyMbkh7iwHpT69IPKRYl2e1Ng5mKik2zZfYhjykY4yFNcS1wf
Fg16whbcP+2V8+ydwtFghyBFNkieNpYR8bxhjcuKhQmxncrOjU8ERT8j/Z2GwqIkKS1BJDraj
H2TdGIxv5iicKJxnAxBEUounrA3hDUM6l6lgMxQHr7NZijq9TJSG4MWRVrDsTUUJqV5TXY+4q
pqOMG2V8tAQ0Z61zOl6Qpo2iEEL+kjPfGvOn19XN+szpqyDsCpzoiOZ/9CU+ExxPU09oBZ31H
8y+6yf3fzPXwgd7ZaDGp7WYrAnnxRVVE/bW8uu2EObjZrw511HX7rF3Ofdp55WUIrq1plQz/C
qdrx8PsAup+81BUVovn5CabBZ8AbA7CRqShL867/Et6p0dlyyonZjU3MpDd+lwlWIyPdTqrnk
bTWf4NyvwjXRBEKaqOtAlwWqcdKrKG3Zlkvvj5Ql+MIW6A3qmoXHikVfuk5wXXbXomYdRvQGM
kGNkyaj6AbL/AgVns122BUPlyivHXy8rOs9CMJbMlA==
Received-SPF: pass client-ip=217.72.192.73; envelope-from=jean@HIDDEN;
helo=mout.kundenserver.de
X-Spam_score_int: -18
X-Spam_score: -1.9
X-Spam_bar: -
X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001,
RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001,
SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)
--=-/uCFF9OG9+W/ZLCTFSrm
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
The following code demonstrates that when byte-compiling (but not when
interpreting), the call (- x) is transformed into (- 0 x). This results
in failure of custom - methods defined via GOOPS.
I think this says it all:
$ guile3.0
GNU Guile 3.0.7 [...]
scheme@(guile-user)> ,optimize (- x)
$1 =3D (- 0 x)
The longer version:
$ cat minus.scm=20
(use-modules (oop goops))
(define-class <Foo> ()
(bar #:init-keyword #:bar))
(define-method (- (x <Foo>))
(make <Foo> #:bar (- (slot-ref x 'bar))))
(display (slot-ref (- (make <Foo> #:bar 5))
'bar))
(newline)
$ guile3.0 --no-auto-compile minus.scm=20
-5
$ guile3.0 minus.scm=20
;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=3D0
;;; or pass the --no-auto-compile argument to disable.
;;; compiling /home/jean/tmp/minus.scm
;;; compiled /home/jean/.cache/guile/ccache/3.0-LE-8-
4.5/home/jean/tmp/minus.scm.go
Backtrace:
In ice-9/boot-9.scm:
1752:10 8 (with-exception-handler _ _ #:unwind? _ # _)
In unknown file:
7 (apply-smob/0 #<thunk 7f569a4a0f60>)
In ice-9/boot-9.scm:
724:2 6 (call-with-prompt _ _ #<procedure default-prompt-handle=E2=80=
=A6>)
In ice-9/eval.scm:
619:8 5 (_ #(#(#<directory (guile-user) 7f569a499c80>)))
In ice-9/boot-9.scm:
2835:4 4 (save-module-excursion _)
4380:12 3 (_)
In /home/jean/tmp/minus.scm:
9:19 2 (_)
In oop/goops.scm:
1567:11 1 (cache-miss 0 #<<Foo> 7f56944e70b0>)
1585:2 0 (_ _ _)
oop/goops.scm:1585:2: No applicable method for #<<generic> - (1)> in call (=
- 0
#<<Foo> 7f56944e70b0>)
--=-/uCFF9OG9+W/ZLCTFSrm
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: This is a digitally signed message part
-----BEGIN PGP SIGNATURE-----
iHUEABYKAB0WIQSZ7TKxnKGyBvBjzBmj8PYLiTOX/gUCZKgLbwAKCRCj8PYLiTOX
/kA/AP97eMsxzCb4Dq1X6Ph1AfDTZ6j6nKDVF3HI5VQIvrrlPwEAqwYEnPFWCtkd
NWMCYj1t4pKR9Q2dUyZRLcea789/Egk=
=JJRk
-----END PGP SIGNATURE-----
--=-/uCFF9OG9+W/ZLCTFSrm--
Jean Abou Samra <jean@HIDDEN>:bug-guile@HIDDEN.
Full text available.bug-guile@HIDDEN:bug#64508; Package guile.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.