From unknown Thu Aug 21 14:54:18 2025 X-Loop: help-debbugs@gnu.org Subject: bug#10756: [2.0.5+] Miscompilation with peval: local shadows module-ref Resent-From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-guile@gnu.org Resent-Date: Tue, 07 Feb 2012 23:06:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 10756 X-GNU-PR-Package: guile X-GNU-PR-Keywords: To: 10756@debbugs.gnu.org X-Debbugs-Original-To: bug-guile@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.132865592215314 (code B ref -1); Tue, 07 Feb 2012 23:06:01 +0000 Received: (at submit) by debbugs.gnu.org; 7 Feb 2012 23:05:22 +0000 Received: from localhost ([127.0.0.1]:59581 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Ruu6D-0003yw-Ms for submit@debbugs.gnu.org; Tue, 07 Feb 2012 18:05:22 -0500 Received: from eggs.gnu.org ([140.186.70.92]:44535) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Ruu6B-0003yk-GO for submit@debbugs.gnu.org; Tue, 07 Feb 2012 18:05:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ruu59-0002Y4-Af for submit@debbugs.gnu.org; Tue, 07 Feb 2012 18:04:16 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([140.186.70.17]:38310) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ruu59-0002Xz-9C for submit@debbugs.gnu.org; Tue, 07 Feb 2012 18:04:15 -0500 Received: from eggs.gnu.org ([140.186.70.92]:52384) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ruu58-00037w-BC for bug-guile@gnu.org; Tue, 07 Feb 2012 18:04:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ruu56-0002Xc-SZ for bug-guile@gnu.org; Tue, 07 Feb 2012 18:04:14 -0500 Received: from xanadu.aquilenet.fr ([88.191.123.111]:34373) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ruu56-0002XW-M4 for bug-guile@gnu.org; Tue, 07 Feb 2012 18:04:12 -0500 Received: from localhost (xanadu.aquilenet.fr [127.0.0.1]) by xanadu.aquilenet.fr (Postfix) with ESMTP id 98435699E for ; Wed, 8 Feb 2012 00:04:11 +0100 (CET) Received: from xanadu.aquilenet.fr ([127.0.0.1]) by localhost (xanadu.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id HkCN2agWhqgN for ; Wed, 8 Feb 2012 00:04:11 +0100 (CET) Received: from pluto (reverse-83.fdn.fr [80.67.176.83]) by xanadu.aquilenet.fr (Postfix) with ESMTPSA id 22CB92F72 for ; Wed, 8 Feb 2012 00:04:11 +0100 (CET) From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 20 =?UTF-8?Q?Pluvi=C3=B4se?= an 220 de la =?UTF-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0xEA52ECF4 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 83C4 F8E5 10A3 3B4C 5BEA D15D 77DD 95E2 EA52 ECF4 X-OS: x86_64-unknown-linux-gnu Date: Wed, 08 Feb 2012 00:04:10 +0100 Message-ID: <87aa4ufdp1.fsf@gnu.org> User-Agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.17 X-Spam-Score: -4.2 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.2 (----) Hi! Consider this: --8<---------------cut here---------------start------------->8--- scheme@(guile-user)> ,optimize (define (foo) (define bar (@ (chbouib) bar))= bar) $11 =3D (define foo (lambda () (let ((bar-1510 (if #f #f))) (letrec* () (begin (set! bar-1510 bar-1510) bar-1510))))) --8<---------------cut here---------------end--------------->8--- Here, the =E2=80=98bar=E2=80=99 local is always set to *undefined*, wrongfu= lly. Ludo=E2=80=99. From unknown Thu Aug 21 14:54:18 2025 X-Loop: help-debbugs@gnu.org Subject: bug#10756: [2.0.5+] Miscompilation with peval: local shadows module-ref Resent-From: Andy Wingo Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-guile@gnu.org Resent-Date: Thu, 09 Feb 2012 13:19:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 10756 X-GNU-PR-Package: guile X-GNU-PR-Keywords: To: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) Cc: 10756@debbugs.gnu.org Received: via spool by 10756-submit@debbugs.gnu.org id=B10756.132879352427078 (code B ref 10756); Thu, 09 Feb 2012 13:19:01 +0000 Received: (at 10756) by debbugs.gnu.org; 9 Feb 2012 13:18:44 +0000 Received: from localhost ([127.0.0.1]:33435 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RvTtb-00072g-9e for submit@debbugs.gnu.org; Thu, 09 Feb 2012 08:18:43 -0500 Received: from a-pb-sasl-sd.pobox.com ([74.115.168.62]:56869 helo=sasl.smtp.pobox.com) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RvTtT-00072R-2Q for 10756@debbugs.gnu.org; Thu, 09 Feb 2012 08:18:42 -0500 Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTP id 3D1E366E1; Thu, 9 Feb 2012 08:17:27 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type:content-transfer-encoding; s=sasl; bh=OfDdX/4PJ4zx 8QvqwjxrpB3ccEU=; b=BJAQRG++9nQtlare5X4pYV9JxtB/NUKoGyf+rypTeUqz 3GaBuhPmkdRxexaYx7U64RXOFaPaWXaTn1DvU44aNP6rvpeZgUVubwCFet4UiM8S XaaZ3jt02OBkmZS9S6MlzAVHKGEWTMqm3srX4m1RwbU7PEl8b699CUf+CpdSjJY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type:content-transfer-encoding; q=dns; s=sasl; b=h3KYIl lniyUL6ebRHn6RfyB/97jZoucgcEUV07+OZwh3HHnttq/MMzouHK7xWBzGOmOEQS VNDTVcvqWvxIAKVu37F+bdjL5fo2nHDyW+79/nI/bMk/DRbarOAJ47+SFZCfa6Y0 8+m9kXxMo2hoc3Zf3KtzFxojMNgOpD25+Dukg= Received: from a-pb-sasl-sd.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTP id 355EF66E0; Thu, 9 Feb 2012 08:17:27 -0500 (EST) Received: from badger (unknown [90.164.198.39]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTPSA id 8F1A366DF; Thu, 9 Feb 2012 08:17:26 -0500 (EST) From: Andy Wingo References: <87aa4ufdp1.fsf@gnu.org> Date: Thu, 09 Feb 2012 14:17:22 +0100 In-Reply-To: <87aa4ufdp1.fsf@gnu.org> ("Ludovic =?UTF-8?Q?Court=C3=A8s?="'s message of "Wed, 08 Feb 2012 00:04:10 +0100") Message-ID: <8739ak16zh.fsf@pobox.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Pobox-Relay-ID: 693B2EE0-5320-11E1-8DC7-65B1DE995924-02397024!a-pb-sasl-sd.pobox.com X-Spam-Score: -1.9 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) On Wed 08 Feb 2012 00:04, ludo@gnu.org (Ludovic Court=C3=A8s) writes: > scheme@(guile-user)> ,optimize (define (foo) (define bar (@ (chbouib) bar= )) bar) > $11 =3D (define foo > (lambda () > (let ((bar-1510 (if #f #f))) > (letrec* > () > (begin (set! bar-1510 bar-1510) bar-1510))))) > > Here, the =E2=80=98bar=E2=80=99 local is always set to *undefined*, wrong= fully. It's actually an expander bug: scheme@(guile-user)> ,expand (define (foo) (define bar (@ (chbouib) bar)) b= ar) $2 =3D (define foo (lambda () (letrec* ((bar-92 bar-92)) bar-92))) Andy --=20 http://wingolog.org/ From unknown Thu Aug 21 14:54:18 2025 X-Loop: help-debbugs@gnu.org Subject: bug#10756: [2.0.5+] Miscompilation with peval: local shadows module-ref Resent-From: Mark H Weaver Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-guile@gnu.org Resent-Date: Thu, 08 Mar 2012 07:15:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 10756 X-GNU-PR-Package: guile X-GNU-PR-Keywords: To: Andy Wingo Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= , 10756@debbugs.gnu.org Received: via spool by 10756-submit@debbugs.gnu.org id=B10756.13311908681147 (code B ref 10756); Thu, 08 Mar 2012 07:15:01 +0000 Received: (at 10756) by debbugs.gnu.org; 8 Mar 2012 07:14:28 +0000 Received: from localhost ([127.0.0.1]:38479 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S5XYR-0000I9-L3 for submit@debbugs.gnu.org; Thu, 08 Mar 2012 02:14:27 -0500 Received: from world.peace.net ([96.39.62.75]:40362) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S5XYE-0000HP-Ik for 10756@debbugs.gnu.org; Thu, 08 Mar 2012 02:14:15 -0500 Received: from 209-6-91-212.c3-0.smr-ubr1.sbo-smr.ma.cable.rcn.com ([209.6.91.212] helo=yeeloong) by world.peace.net with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1S5XX6-00015p-4g; Thu, 08 Mar 2012 02:13:04 -0500 From: Mark H Weaver References: <87aa4ufdp1.fsf@gnu.org> <8739ak16zh.fsf@pobox.com> Date: Thu, 08 Mar 2012 02:11:01 -0500 In-Reply-To: <8739ak16zh.fsf@pobox.com> (Andy Wingo's message of "Thu, 09 Feb 2012 14:17:22 +0100") Message-ID: <87y5rbtvne.fsf@netris.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -1.9 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) Andy Wingo writes: > On Wed 08 Feb 2012 00:04, ludo@gnu.org (Ludovic Court=C3=A8s) writes: > >> scheme@(guile-user)> ,optimize (define (foo) (define bar (@ (chbouib) ba= r)) bar) >> $11 =3D (define foo >> (lambda () >> (let ((bar-1510 (if #f #f))) >> (letrec* >> () >> (begin (set! bar-1510 bar-1510) bar-1510))))) >> >> Here, the =E2=80=98bar=E2=80=99 local is always set to *undefined*, wron= gfully. > > It's actually an expander bug: > > scheme@(guile-user)> ,expand (define (foo) (define bar (@ (chbouib) bar))= bar) > $2 =3D (define foo > (lambda () (letrec* ((bar-92 bar-92)) bar-92))) > > Andy I've attached a patch that fixes this bug. Fixing '@' was literally a one word fix (w -> top-wrap), and the same would have been true of '@@' if not for the way it had been extended to support R6RS library forms. Unlike '@' which uses syntax->datum on the 'id' to strip the wrap, '@@' kept syntax objects fully intact and only changed their module. I think it was a mistake to overload '@@' to do these two different jobs, so I changed the R6RS-support syntax to (@@ @@ (mod ...) body) and left its behavior as-is, and then made (@@ (mod ...) id) act the same way as '@': use 'syntax->datum' on the 'id' and return top-wrap. I think it's okay to change the internal R6RS-support syntax in stable-2.0, because it's undocumented and only exists as a temporary intermediate form during macro expansion. What do you think? Also: since 'boot-9.go' was not automatically recompiled by changing 'r6rs-libraries.scm', I added explicit dependencies to module/Makefile.am. However, I'm almost wholly ignorant of automake, so please double-check what I did there. Thanks, Mark From unknown Thu Aug 21 14:54:18 2025 X-Loop: help-debbugs@gnu.org Subject: bug#10756: [2.0.5+] Miscompilation with peval: local shadows module-ref Resent-From: Mark H Weaver Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-guile@gnu.org Resent-Date: Thu, 08 Mar 2012 07:18:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 10756 X-GNU-PR-Package: guile X-GNU-PR-Keywords: To: Andy Wingo Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= , 10756@debbugs.gnu.org Received: via spool by 10756-submit@debbugs.gnu.org id=B10756.13311910281405 (code B ref 10756); Thu, 08 Mar 2012 07:18:02 +0000 Received: (at 10756) by debbugs.gnu.org; 8 Mar 2012 07:17:08 +0000 Received: from localhost ([127.0.0.1]:38483 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S5Xb1-0000M5-CU for submit@debbugs.gnu.org; Thu, 08 Mar 2012 02:17:08 -0500 Received: from world.peace.net ([96.39.62.75]:40366) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1S5Xao-0000Ld-C4 for 10756@debbugs.gnu.org; Thu, 08 Mar 2012 02:16:55 -0500 Received: from 209-6-91-212.c3-0.smr-ubr1.sbo-smr.ma.cable.rcn.com ([209.6.91.212] helo=yeeloong) by world.peace.net with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1S5XZd-00016O-EN; Thu, 08 Mar 2012 02:15:42 -0500 From: Mark H Weaver References: <87aa4ufdp1.fsf@gnu.org> <8739ak16zh.fsf@pobox.com> Date: Thu, 08 Mar 2012 02:13:37 -0500 In-Reply-To: <8739ak16zh.fsf@pobox.com> (Andy Wingo's message of "Thu, 09 Feb 2012 14:17:22 +0100") Message-ID: <87ty1ztvj2.fsf@netris.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -1.9 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) --=-=-= Content-Type: text/plain And here's the actual patch. Mark --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: inline; filename=0001-Fix-and-to-not-capture-lexicals-new-form-for-R6RS-li.patch Content-Transfer-Encoding: quoted-printable Content-Description: [PATCH] Fix @ and @@ to not capture lexicals; new @@ @@ form for R6RS libraries >From 13668b618c4345d51a5667056d1d515c21a874a9 Mon Sep 17 00:00:00 2001 From: Mark H Weaver Date: Thu, 8 Mar 2012 01:24:25 -0500 Subject: [PATCH] Fix @ and @@ to not capture lexicals; new @@ @@ form for R6RS libraries MIME-Version: 1.0 Content-Type: text/plain; charset=3DUTF-8 Content-Transfer-Encoding: 8bit * module/ice-9/psyntax.scm (@): Return top-wrap instead of the wrap applied to the '@' form, so that the symbol will be interpreted as a top-level identifier and never refer to any lexical variable. (@@): Change the syntax used to support R6RS 'library' forms to: (@@ @@ (mod ...) body). Change the behavior of the documented (@@ (mod ...) id) form to be the same as that of @, except for the use of 'private' instead of 'public' in the psyntax mod: use syntax->datum on the identifier, and return top-wrap instead of the wrap applied to the '@@' form. This fixes reported by Ludovic Court=C3=A8s. * module/ice-9/psyntax-pp.scm: Regenerate. * module/ice-9/r6rs-libraries.scm (library): Use '@@ @@' syntax instead of the older '@@' syntax. * test-suite/tests/syncase.test (changes to expansion environment): Use '@@ @@' syntax. * module/Makefile.am: Add explicit dependencies for boot-9.go on the files that it includes: quasisyntax.scm and r6rs-libraries.scm. --- module/Makefile.am | 2 ++ module/ice-9/psyntax-pp.scm | 36 ++++++++++++++++++++++++++---------- module/ice-9/psyntax.scm | 19 ++++++++++++++++--- module/ice-9/r6rs-libraries.scm | 2 +- test-suite/tests/syncase.test | 16 ++++++++-------- 5 files changed, 53 insertions(+), 22 deletions(-) diff --git a/module/Makefile.am b/module/Makefile.am index 9c9d8ed..a97f2ef 100644 --- a/module/Makefile.am +++ b/module/Makefile.am @@ -32,6 +32,8 @@ nobase_ccache_DATA +=3D ice-9/eval.go EXTRA_DIST +=3D ice-9/eval.scm ETAGS_ARGS +=3D ice-9/eval.scm =20 +ice-9/boot-9.go: ice-9/boot-9.scm ice-9/quasisyntax.scm ice-9/r6rs-librari= es.scm + # We can compile these in any order, but it's fastest if we compile # psyntax and boot-9 first, then the compiler itself, then the rest of # the code. diff --git a/module/ice-9/psyntax-pp.scm b/module/ice-9/psyntax-pp.scm index 7475983..68d1bf6 100644 --- a/module/ice-9/psyntax-pp.scm +++ b/module/ice-9/psyntax-pp.scm @@ -1950,7 +1950,7 @@ (values (syntax->datum id) r - w + '((top)) #f (syntax->datum (cons '#(syntax-object public ((top)) (hygiene guil= e)) mod)))) @@ -1982,16 +1982,32 @@ (loop (+ i 1))))))) (else x))))) (let* ((tmp-1 e) (tmp ($sc-dispatch tmp-1 '(_ each-any any)))) - (if (and tmp (apply (lambda (mod exp) (and-map id? mod)) tmp)) - (apply (lambda (mod exp) - (let ((mod (syntax->datum - (cons '#(syntax-object private ((top)) (= hygiene guile)) mod)))) - (values (remodulate exp mod) r w (source-annotation= exp) mod))) + (if (and tmp + (apply (lambda (mod id) (and (and-map id? mod) (id? id)= )) tmp)) + (apply (lambda (mod id) + (values + (syntax->datum id) + r + '((top)) + #f + (syntax->datum + (cons '#(syntax-object private ((top)) (hygiene g= uile)) mod)))) tmp) - (syntax-violation - #f - "source expression failed to match any pattern" - tmp-1)))))) + (let ((tmp ($sc-dispatch + tmp-1 + '(_ #(free-id #(syntax-object @@ ((top)) (hygiene= guile))) + each-any + any)))) + (if (and tmp (apply (lambda (mod exp) (and-map id? mod)) tmp= )) + (apply (lambda (mod exp) + (let ((mod (syntax->datum + (cons '#(syntax-object private ((top= )) (hygiene guile)) mod)))) + (values (remodulate exp mod) r w (source-annota= tion exp) mod))) + tmp) + (syntax-violation + #f + "source expression failed to match any pattern" + tmp-1)))))))) (global-extend 'core 'if diff --git a/module/ice-9/psyntax.scm b/module/ice-9/psyntax.scm index 6015eff..b8ab8b8 100644 --- a/module/ice-9/psyntax.scm +++ b/module/ice-9/psyntax.scm @@ -2239,7 +2239,9 @@ (syntax-case e () ((_ (mod ...) id) (and (and-map id? #'(mod ...)) (id? #'id)) - (values (syntax->datum #'id) r w #f + ;; Strip the wrap from the identifier and return t= op-wrap + ;; so that the identifier will not be captured by = lexicals. + (values (syntax->datum #'id) r top-wrap #f (syntax->datum #'(public mod ...))))))) =20 @@ -2262,9 +2264,20 @@ ((fx=3D i n) v) (vector-set! v i (remodulate (vector-r= ef x i) mod))))) (else x)))) - (syntax-case e () - ((_ (mod ...) exp) + (syntax-case e (@@) + ((_ (mod ...) id) + (and (and-map id? #'(mod ...)) (id? #'id)) + ;; Strip the wrap from the identifier and return t= op-wrap + ;; so that the identifier will not be captured by = lexicals. + (values (syntax->datum #'id) r top-wrap #f + (syntax->datum + #'(private mod ...)))) + ((_ @@ (mod ...) exp) (and-map id? #'(mod ...)) + ;; This is a special syntax used to support R6RS l= ibrary forms. + ;; Unlike the syntax above, the last item is not r= estricted to + ;; be a single identifier, and the syntax objects = are kept + ;; intact, with only their module changed. (let ((mod (syntax->datum #'(private mod ...)))) (values (remodulate #'exp mod) r w (source-annotation #'exp) diff --git a/module/ice-9/r6rs-libraries.scm b/module/ice-9/r6rs-libraries.= scm index bf1127e..f71b90b 100644 --- a/module/ice-9/r6rs-libraries.scm +++ b/module/ice-9/r6rs-libraries.scm @@ -197,7 +197,7 @@ (export e ...) (re-export r ...) (export! x ...) - (@@ (name name* ...) body) + (@@ @@ (name name* ...) body) ...)))))))) =20=20=20=20=20 (define-syntax import diff --git a/test-suite/tests/syncase.test b/test-suite/tests/syncase.test index 6183df8..0e81f65 100644 --- a/test-suite/tests/syncase.test +++ b/test-suite/tests/syncase.test @@ -115,16 +115,16 @@ 'foo))) =20 (with-test-prefix "changes to expansion environment" - (pass-if "expander detects changes to current-module with @@" + (pass-if "expander detects changes to current-module with @@ @@" (compile '(begin (define-module (new-module)) - (@@ (new-module) - (define-syntax new-module-macro - (lambda (stx) - (syntax-case stx ()=20 - ((_ arg) (syntax arg)))))) - (@@ (new-module) - (new-module-macro #t))) + (@@ @@ (new-module) + (define-syntax new-module-macro + (lambda (stx) + (syntax-case stx ()=20 + ((_ arg) (syntax arg)))))) + (@@ @@ (new-module) + (new-module-macro #t))) #:env (current-module)))) =20 (define-module (test-suite test-syncase-2) --=20 1.7.5.4 --=-=-=-- From unknown Thu Aug 21 14:54:18 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.428 (Entity 5.428) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) Subject: bug#10756: closed (Re: bug#10756: [2.0.5+] Miscompilation with peval: local shadows module-ref) Message-ID: References: <87vci0wy3m.fsf@pobox.com> <87aa4ufdp1.fsf@gnu.org> X-Gnu-PR-Message: they-closed 10756 X-Gnu-PR-Package: guile Reply-To: 10756@debbugs.gnu.org Date: Fri, 06 Jul 2012 18:26:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1341599162-16485-1" This is a multi-part message in MIME format... ------------=_1341599162-16485-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #10756: [2.0.5+] Miscompilation with peval: local shadows module-ref which was filed against the guile package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 10756@debbugs.gnu.org. --=20 10756: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D10756 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1341599162-16485-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 10756-done) by debbugs.gnu.org; 6 Jul 2012 18:25:19 +0000 Received: from localhost ([127.0.0.1]:53139 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SnDDT-0004Gq-5l for submit@debbugs.gnu.org; Fri, 06 Jul 2012 14:25:19 -0400 Received: from a-pb-sasl-sd.pobox.com ([74.115.168.62]:36660 helo=sasl.smtp.pobox.com) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SnDDR-0004Gj-4A for 10756-done@debbugs.gnu.org; Fri, 06 Jul 2012 14:25:18 -0400 Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by b-pb-sasl-sd.pobox.com (Postfix) with ESMTP id 84BD4CAB2; Fri, 6 Jul 2012 14:20:17 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=sasl; bh=hFGWOEjoi8LZjdgWG4hLAzB2vhI=; b=Q+axUI fXYel69Qqg4rdjCd/EKRloSUe7kK9bLjBM+/kVC6ySMNkB/de2TYDEvvNta0Bgnl lGfhiSRc34w3213twIlUmOMpXISr2Eic551uq7nsOjDZqQ2G7JTqhl1zHHRSZ0co v2mOxkHnFIDsnpm8dYy86gEw8ZKFaKjWAWNWs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=sasl; b=b2F7CQH1mElDfbH2YcfVfbcTGQCyZzle JkqtkL+DyXhKxJrTxM8esnH7HdOvx59xhG4Y18x3FZo6l5oWEsZ4HqutOT4vEmeM ekb9diGs90MeJBk+gWUMSSOKLoByyYOi9XUPo8yTkXWa9ak4Iy4gzIVSw3p055Oz zV5n6+wZ98c= Received: from b-pb-sasl-sd. (unknown [127.0.0.1]) by b-pb-sasl-sd.pobox.com (Postfix) with ESMTP id 7DA22CAB1; Fri, 6 Jul 2012 14:20:17 -0400 (EDT) Received: from badger (unknown [89.131.176.233]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by b-pb-sasl-sd.pobox.com (Postfix) with ESMTPSA id B7B25CAB0; Fri, 6 Jul 2012 14:20:16 -0400 (EDT) From: Andy Wingo To: Mark H Weaver Subject: Re: bug#10756: [2.0.5+] Miscompilation with peval: local shadows module-ref References: <87aa4ufdp1.fsf@gnu.org> <8739ak16zh.fsf@pobox.com> <87y5rbtvne.fsf@netris.org> Date: Fri, 06 Jul 2012 20:20:13 +0200 In-Reply-To: <87y5rbtvne.fsf@netris.org> (Mark H. Weaver's message of "Thu, 08 Mar 2012 02:11:01 -0500") Message-ID: <87vci0wy3m.fsf@pobox.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Pobox-Relay-ID: 3CA1E090-C797-11E1-B39E-FA6787E41631-02397024!b-pb-sasl-sd.pobox.com X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10756-done Cc: Ludovic =?utf-8?Q?Court=C3=A8s?= , 10756-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) On Thu 08 Mar 2012 08:11, Mark H Weaver writes: >> scheme@(guile-user)> ,expand (define (foo) (define bar (@ (chbouib) bar)) bar) >> $2 = (define foo >> (lambda () (letrec* ((bar-92 bar-92)) bar-92))) >> >> Andy > > I've attached a patch that fixes this bug. Fixing '@' was literally a > one word fix (w -> top-wrap), and the same would have been true of '@@' > if not for the way it had been extended to support R6RS library forms. > Unlike '@' which uses syntax->datum on the 'id' to strip the wrap, '@@' > kept syntax objects fully intact and only changed their module. > > I think it was a mistake to overload '@@' to do these two different > jobs, so I changed the R6RS-support syntax to (@@ @@ (mod ...) body) and > left its behavior as-is, and then made (@@ (mod ...) id) act the same > way as '@': use 'syntax->datum' on the 'id' and return top-wrap. > > I think it's okay to change the internal R6RS-support syntax in > stable-2.0, because it's undocumented and only exists as a temporary > intermediate form during macro expansion. What do you think? > > Also: since 'boot-9.go' was not automatically recompiled by changing > 'r6rs-libraries.scm', I added explicit dependencies to > module/Makefile.am. However, I'm almost wholly ignorant of automake, so > please double-check what I did there. Looks great to me, pushed. It's strictly incompatible, but hey. Sorry for taking so long! The only thing I would note is that it seems to me that this "R6RS-support" is useful in a general sense. Just an impression though, I've never had occasion to use it outside the R6RS libs. Regards, and thanks very much, Andy -- http://wingolog.org/ ------------=_1341599162-16485-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 7 Feb 2012 23:05:22 +0000 Received: from localhost ([127.0.0.1]:59581 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Ruu6D-0003yw-Ms for submit@debbugs.gnu.org; Tue, 07 Feb 2012 18:05:22 -0500 Received: from eggs.gnu.org ([140.186.70.92]:44535) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Ruu6B-0003yk-GO for submit@debbugs.gnu.org; Tue, 07 Feb 2012 18:05:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ruu59-0002Y4-Af for submit@debbugs.gnu.org; Tue, 07 Feb 2012 18:04:16 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([140.186.70.17]:38310) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ruu59-0002Xz-9C for submit@debbugs.gnu.org; Tue, 07 Feb 2012 18:04:15 -0500 Received: from eggs.gnu.org ([140.186.70.92]:52384) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ruu58-00037w-BC for bug-guile@gnu.org; Tue, 07 Feb 2012 18:04:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ruu56-0002Xc-SZ for bug-guile@gnu.org; Tue, 07 Feb 2012 18:04:14 -0500 Received: from xanadu.aquilenet.fr ([88.191.123.111]:34373) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ruu56-0002XW-M4 for bug-guile@gnu.org; Tue, 07 Feb 2012 18:04:12 -0500 Received: from localhost (xanadu.aquilenet.fr [127.0.0.1]) by xanadu.aquilenet.fr (Postfix) with ESMTP id 98435699E for ; Wed, 8 Feb 2012 00:04:11 +0100 (CET) Received: from xanadu.aquilenet.fr ([127.0.0.1]) by localhost (xanadu.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id HkCN2agWhqgN for ; Wed, 8 Feb 2012 00:04:11 +0100 (CET) Received: from pluto (reverse-83.fdn.fr [80.67.176.83]) by xanadu.aquilenet.fr (Postfix) with ESMTPSA id 22CB92F72 for ; Wed, 8 Feb 2012 00:04:11 +0100 (CET) From: ludo@gnu.org (Ludovic =?iso-8859-1?Q?Court=E8s?=) To: bug-guile@gnu.org Subject: [2.0.5+] Miscompilation with peval: local shadows module-ref X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 20 =?iso-8859-1?Q?Pluvi=F4se?= an 220 de la =?iso-8859-1?Q?R=E9volution?= X-PGP-Key-ID: 0xEA52ECF4 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 83C4 F8E5 10A3 3B4C 5BEA D15D 77DD 95E2 EA52 ECF4 X-OS: x86_64-unknown-linux-gnu Date: Wed, 08 Feb 2012 00:04:10 +0100 Message-ID: <87aa4ufdp1.fsf@gnu.org> User-Agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.17 X-Spam-Score: -4.2 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.2 (----) Hi! Consider this: --8<---------------cut here---------------start------------->8--- scheme@(guile-user)> ,optimize (define (foo) (define bar (@ (chbouib) bar))= bar) $11 =3D (define foo (lambda () (let ((bar-1510 (if #f #f))) (letrec* () (begin (set! bar-1510 bar-1510) bar-1510))))) --8<---------------cut here---------------end--------------->8--- Here, the =E2=80=98bar=E2=80=99 local is always set to *undefined*, wrongfu= lly. Ludo=E2=80=99. ------------=_1341599162-16485-1--