From: Andy Wingo <wingo@pobox.com>
To: Zefram <zefram@fysh.org>
Cc: 21899-done@debbugs.gnu.org
Subject: bug#21899: let/ec continuations not distinct under compiler
Date: Fri, 24 Jun 2016 19:13:01 +0200 [thread overview]
Message-ID: <87r3bmcxya.fsf@pobox.com> (raw)
In-Reply-To: <20160624170038.GG1170@fysh.org> (zefram@fysh.org's message of "Fri, 24 Jun 2016 18:00:38 +0100")
[-- Attachment #1: Type: text/plain, Size: 306 bytes --]
On Fri 24 Jun 2016 19:00, Zefram <zefram@fysh.org> writes:
> Andy Wingo wrote:
>> ,opt (let* ((x (list 'a))
>> (y (list 'a)))
>> (list x y))
>> ;; ->
>> (let* ((x (list 'a)) (y x)) (list x y))
>
> Wow, that's a scary level of wrongitude.
Indeed :/
Fixed in git with this patch:
[-- Attachment #2: 0001-Fix-bug-that-exposed-list-invocations-to-CSE.patch --]
[-- Type: text/plain, Size: 2518 bytes --]
From ea352d9e54793783a8272863748ea6d31b3f7295 Mon Sep 17 00:00:00 2001
From: Andy Wingo <wingo@pobox.com>
Date: Fri, 24 Jun 2016 19:03:36 +0200
Subject: [PATCH] Fix bug that exposed `list' invocations to CSE
* module/language/tree-il/effects.scm (make-effects-analyzer):
Fix analysis for list, cons, make-prompt-tage, and vector; &allocation
is a `cause' effect. Fixes #21899.
* test-suite/tests/cse.test ("cse"): Add test case.
---
module/language/tree-il/effects.scm | 8 ++++----
test-suite/tests/cse.test | 9 +++++++++
2 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/module/language/tree-il/effects.scm b/module/language/tree-il/effects.scm
index 1fe4aeb..6db4d47 100644
--- a/module/language/tree-il/effects.scm
+++ b/module/language/tree-il/effects.scm
@@ -278,16 +278,16 @@ of an expression."
;; Primitives that allocate memory.
(($ <application> _ ($ <primitive-ref> _ 'cons) (x y))
(logior (compute-effects x) (compute-effects y)
- &allocation))
+ (cause &allocation)))
(($ <application> _ ($ <primitive-ref> _ (or 'list 'vector)) args)
- (logior (accumulate-effects args) &allocation))
+ (logior (accumulate-effects args) (cause &allocation)))
(($ <application> _ ($ <primitive-ref> _ 'make-prompt-tag) ())
- &allocation)
+ (cause &allocation))
(($ <application> _ ($ <primitive-ref> _ 'make-prompt-tag) (arg))
- (logior (compute-effects arg) &allocation))
+ (logior (compute-effects arg) (cause &allocation)))
;; Primitives that are normally effect-free, but which might
;; cause type checks, allocate memory, or access mutable
diff --git a/test-suite/tests/cse.test b/test-suite/tests/cse.test
index e0219e8..ca7dbc2 100644
--- a/test-suite/tests/cse.test
+++ b/test-suite/tests/cse.test
@@ -294,6 +294,15 @@
(apply (primitive cons) (const 1) (const 2) (const 3))
(const 4)))
+ ;; The (list 'a) does not propagate.
+ (pass-if-cse
+ (let* ((x (list 'a))
+ (y (list 'a)))
+ (list x y))
+ (let (x) (_) ((apply (primitive list) (const a)))
+ (let (y) (_) ((apply (primitive list) (const a)))
+ (apply (primitive list) (lexical x _) (lexical y _)))))
+
(pass-if "http://bugs.gnu.org/12883"
;; In 2.0.6, compiling this code would trigger an out-of-bounds
;; vlist access in CSE's traversal of its "database".
--
2.8.3
prev parent reply other threads:[~2016-06-24 17:13 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-13 7:57 bug#21899: let/ec continuations not distinct under compiler Zefram
2016-06-24 16:29 ` Andy Wingo
2016-06-24 16:48 ` Andy Wingo
2016-06-24 17:00 ` Zefram
2016-06-24 17:11 ` Zefram
2016-06-24 17:13 ` Andy Wingo [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87r3bmcxya.fsf@pobox.com \
--to=wingo@pobox.com \
--cc=21899-done@debbugs.gnu.org \
--cc=zefram@fysh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).