summaryrefslogtreecommitdiff
path: root/module/language
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2021-05-01 22:13:24 +0200
committerAndy Wingo <wingo@pobox.com>2021-05-01 22:16:20 +0200
commit44a6a21dcc11d6da39d4548362cf63452a07bdbd (patch)
tree5498f481568eda0f24de984184a0b410a4889b29 /module/language
parent3383a2cb10b32b428c28495a84f4e4a40d34c9ee (diff)
downloadguile-44a6a21dcc11d6da39d4548362cf63452a07bdbd.tar.gz
Fix tree-il effects analysis for prompts
* module/language/tree-il/effects.scm (make-effects-analyzer): The body of a prompt is an expression only for escape-only prompts, and the handler is always a lambda. Fix bug where a prompt could be incorrectly marked effect-free. * test-suite/tests/tree-il.test ("optimize"): Add test for bug 48098. Fixes bug 48098.
Diffstat (limited to 'module/language')
-rw-r--r--module/language/tree-il/effects.scm10
1 files changed, 7 insertions, 3 deletions
diff --git a/module/language/tree-il/effects.scm b/module/language/tree-il/effects.scm
index 6e5ff33a0..f69f84165 100644
--- a/module/language/tree-il/effects.scm
+++ b/module/language/tree-il/effects.scm
@@ -1,6 +1,6 @@
;;; Effects analysis on Tree-IL
-;; Copyright (C) 2011, 2012, 2013 Free Software Foundation, Inc.
+;; Copyright (C) 2011, 2012, 2013, 2021 Free Software Foundation, Inc.
;;;; This library is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU Lesser General Public
@@ -588,8 +588,12 @@ of an expression."
(($ <prompt> _ escape-only? tag body handler)
(logior (compute-effects tag)
- (compute-effects body)
- (compute-effects handler)))
+ (compute-effects (if escape-only?
+ body
+ (make-call #f body '())))
+ ;; Calls handler with probably wrong argument count,
+ ;; but that will just add a &type-check effect.
+ (compute-effects (make-call #f handler '()))))
(($ <abort> _ tag args tail)
(logior &all-effects-but-bailout