bug-guile
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#10756: [2.0.5+] Miscompilation with peval: local shadows module-ref


From: Mark H Weaver
Subject: bug#10756: [2.0.5+] Miscompilation with peval: local shadows module-ref
Date: Thu, 08 Mar 2012 02:11:01 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux)

Andy Wingo <address@hidden> writes:

> On Wed 08 Feb 2012 00:04, address@hidden (Ludovic Courtès) writes:
>
>> scheme@(guile-user)> ,optimize (define (foo) (define bar (@ (chbouib) bar)) 
>> bar)
>> $11 = (define foo
>>   (lambda ()
>>     (let ((bar-1510 (if #f #f)))
>>       (letrec*
>>         ()
>>         (begin (set! bar-1510 bar-1510) bar-1510)))))
>>
>> Here, the ‘bar’ local is always set to *undefined*, wrongfully.
>
> It's actually an expander bug:
>
> 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.

    Thanks,
      Mark





reply via email to

[Prev in Thread] Current Thread [Next in Thread]