1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-20 18:50:21 +02:00

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.
This commit is contained in:
Andy Wingo 2021-05-01 22:13:24 +02:00
parent 3383a2cb10
commit 44a6a21dcc
2 changed files with 28 additions and 3 deletions

View file

@ -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