guile-commits
[Top][All Lists]
Advanced

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

[Guile-commits] 04/04: Fix bug that exposed `list' invocations to CSE


From: Andy Wingo
Subject: [Guile-commits] 04/04: Fix bug that exposed `list' invocations to CSE
Date: Fri, 24 Jun 2016 17:12:35 +0000 (UTC)

wingo pushed a commit to branch stable-2.0
in repository guile.

commit ea352d9e54793783a8272863748ea6d31b3f7295
Author: Andy Wingo <address@hidden>
Date:   Fri Jun 24 19:03:36 2016 +0200

    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".



reply via email to

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