unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* bug#19417: let, assq-set optimization gone wrong?
@ 2014-12-20  5:51 Matt Wette
  2014-12-20 14:44 ` bug#19417: oops - may not be a bug Matt Wette
  0 siblings, 1 reply; 3+ messages in thread
From: Matt Wette @ 2014-12-20  5:51 UTC (permalink / raw)
  To: 19417; +Cc: mwette

[-- Attachment #1: Type: text/plain, Size: 1835 bytes --]

This was discovered with help from godek.maciek@gmail.com.
It seems the variable "l" in the second let below is bound to the value from the first.
I ran into this bug when using syntax-rules with a let/a-list in the expansion.

mwette$ cat bug.scm
(let ((l '((a . 1) (b . 2)))) (assq-set! l 'b 99))
(let ((l '((a . 1) (b . 2)))) l)
mwette$ guile20
GNU Guile 2.0.11
Copyright (C) 1995-2014 Free Software Foundation, Inc.

Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
This program is free software, and you are welcome to redistribute it
under certain conditions; type `,show c' for details.

Enter `,help' for help.
scheme@(guile-user)> (load "bug.scm")
$1 = ((a . 1) (b . 99))

scheme@(guile-user)> %guile-build-info
$2 = ((buildstamp . "2014-10-07 02:36:10") (CFLAGS . " -I/opt/local/include -D_THREAD_SAFE ") (LIBS . "-L/opt/local/lib  -lm ") (libguileinterface . "29:2:7") (guileversion . "2.0.11") (extensiondir . "/opt/local/lib/guile/2.0/extensions") (pkgincludedir . "/opt/local/include/guile") (pkglibdir . "/opt/local/lib/guile") (pkgdatadir . "/opt/local/share/guile") (includedir . "/opt/local/include") (mandir . "/opt/local/share/man") (infodir . "/opt/local/share/info") (ccachedir . "/opt/local/lib/guile/2.0/ccache") (libdir . "/opt/local/lib") (localstatedir . "/opt/local/var") (sharedstatedir . "/opt/local/com") (sysconfdir . "/opt/local/etc") (datadir . "/opt/local/share") (libexecdir . "/opt/local/libexec") (sbindir . "/opt/local/sbin") (bindir . "/opt/local/bin") (exec_prefix . "/opt/local") (prefix . "/opt/local") (top_srcdir . "/opt/local/var/macports/build/_Users_mwette_proj_macports_ports_lang_guile20/guile20/work/guile-2.0.11") (srcdir . "/opt/local/var/macports/build/_Users_mwette_proj_macports_ports_lang_guile20/guile20/work/guile-2.0.11/libguile"))


[-- Attachment #2: Type: text/html, Size: 3346 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#19417: oops - may not be a bug
  2014-12-20  5:51 bug#19417: let, assq-set optimization gone wrong? Matt Wette
@ 2014-12-20 14:44 ` Matt Wette
  2014-12-22  7:02   ` Mark H Weaver
  0 siblings, 1 reply; 3+ messages in thread
From: Matt Wette @ 2014-12-20 14:44 UTC (permalink / raw)
  To: 19417

I have been told this has to do with '((a . 1) (b . 1)) being a literal.   I'm guessing guile caches this and it get then mutated.







^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#19417: oops - may not be a bug
  2014-12-20 14:44 ` bug#19417: oops - may not be a bug Matt Wette
@ 2014-12-22  7:02   ` Mark H Weaver
  0 siblings, 0 replies; 3+ messages in thread
From: Mark H Weaver @ 2014-12-22  7:02 UTC (permalink / raw)
  To: Matt Wette; +Cc: 19417, request

tags 19417 + notabug
close 19417
thanks

Matt Wette <mwette@alumni.caltech.edu> writes:
> I have been told this has to do with '((a . 1) (b . 1)) being a
> literal.  I'm guessing guile caches this and it get then mutated.

Right.  As explained on guile-user, mutating literal data is not
permitted and leads to unspecified behavior.  Our compiler aggressively
shares data between literals in the same compilation unit.

     Mark





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-12-22  7:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-20  5:51 bug#19417: let, assq-set optimization gone wrong? Matt Wette
2014-12-20 14:44 ` bug#19417: oops - may not be a bug Matt Wette
2014-12-22  7:02   ` Mark H Weaver

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).