GNU bug report logs - #73334
[critical bug] The set! doesn't work in indirect reference

Previous Next

Package: guile;

Reported by: Nala Ginrut <nalaginrut <at> gmail.com>

Date: Wed, 18 Sep 2024 14:39:01 UTC

Severity: normal

To reply to this bug, email your comments to 73334 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guile <at> gnu.org:
bug#73334; Package guile. (Wed, 18 Sep 2024 14:39:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Nala Ginrut <nalaginrut <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-guile <at> gnu.org. (Wed, 18 Sep 2024 14:39:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Nala Ginrut <nalaginrut <at> gmail.com>
To: bug-guile <at> gnu.org
Cc: Guile User <guile-user <at> gnu.org>
Subject: [critical bug] The set! doesn't work in indirect reference
Date: Wed, 18 Sep 2024 23:37:54 +0900
[Message part 1 (text/plain, inline)]
Hi folks!
Recently I was bothered by a strange bug when debugging Artanis, here's how
to reproduce.
You need three files, say aaa.scm, bbb.scm, and entry

---------------------aaa.scm----------------
(define-module (aaa)
 #:export (global))

(define global #f)
----------------------aaa.scm end------------

------------------bbb.scm----------------
(define-module (bbb)
 #:use-module (aaa)
 #:export (fun))

(define (fun)
 (pk 'before global)
 (set! global 123)
 (pk 'after global))
-------------------bbb.scm end-------------



------------------entry-------------
(import (bbb))

(fun)
-----------------entry end-------------


Put all files in the same directory, and run:
----------------cut----------------
guile -L . entry
----------------end---------------


The result is:
;;; (before #f)
;;; (after #f)

The expected result should be:
;; (before #f)
;; (after 123)

------------------------------------------

This was tested in 3.0.9 and 3.0.10.

I also CC  guile-user list, in case anyone was troubled by strange bugs,
this may be a hint.


Best regards.
[Message part 2 (text/html, inline)]

Information forwarded to bug-guile <at> gnu.org:
bug#73334; Package guile. (Wed, 18 Sep 2024 14:51:02 GMT) Full text and rfc822 format available.

Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: "Thompson, David" <dthompson2 <at> worcester.edu>
To: Nala Ginrut <nalaginrut <at> gmail.com>
Cc: bug-guile <at> gnu.org, Guile User <guile-user <at> gnu.org>
Subject: Re: [critical bug] The set! doesn't work in indirect reference
Date: Wed, 18 Sep 2024 10:50:07 -0400
On Wed, Sep 18, 2024 at 10:38 AM Nala Ginrut <nalaginrut <at> gmail.com> wrote:
>
> The result is:
> ;;; (before #f)
> ;;; (after #f)
>
> The expected result should be:
> ;; (before #f)
> ;; (after 123)

I don't think this is a bug. Both modules are declarative (the
default). 'global' from module (aaa) is presumably being inlined into
the 'pk' calls in module (bbb).  If you mark module (bbb) as
'#:declarative? #f' then you get your expected result.

Hope this helps,

- Dave




Information forwarded to bug-guile <at> gnu.org:
bug#73334; Package guile. (Thu, 19 Sep 2024 02:38:01 GMT) Full text and rfc822 format available.

Message #11 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Nala Ginrut <nalaginrut <at> gmail.com>
To: "Thompson, David" <dthompson2 <at> worcester.edu>
Cc: bug-guile <at> gnu.org, Guile User <guile-user <at> gnu.org>
Subject: Re: [critical bug] The set! doesn't work in indirect reference
Date: Thu, 19 Sep 2024 11:34:17 +0900
[Message part 1 (text/plain, inline)]
Thanks for the reply!
I've taken a look at
https://www.gnu.org/software/guile/manual/html_node/Declarative-Modules.html
It's related to #:declarative?

Thanks again!
Best regards.


On Wed, Sep 18, 2024 at 11:50 PM Thompson, David <dthompson2 <at> worcester.edu>
wrote:

> On Wed, Sep 18, 2024 at 10:38 AM Nala Ginrut <nalaginrut <at> gmail.com> wrote:
> >
> > The result is:
> > ;;; (before #f)
> > ;;; (after #f)
> >
> > The expected result should be:
> > ;; (before #f)
> > ;; (after 123)
>
> I don't think this is a bug. Both modules are declarative (the
> default). 'global' from module (aaa) is presumably being inlined into
> the 'pk' calls in module (bbb).  If you mark module (bbb) as
> '#:declarative? #f' then you get your expected result.
>
> Hope this helps,
>
> - Dave
>
[Message part 2 (text/html, inline)]

This bug report was last modified 272 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.