fix optimizer bug

Closes #1461

Thanks to Gustavo for tracking down the problem.
This commit is contained in:
Matthew Flatt 2016-09-15 07:58:21 -06:00
parent cfb2a7aa32
commit 2174f4a029
2 changed files with 12 additions and 2 deletions

View File

@ -6228,7 +6228,17 @@
(write (compile e) o)
(parameterize ([read-accept-compiled #t])
(eval (read (open-input-bytes (get-output-bytes o)))))
((dynamic-require ''uses-mutator-with-an-auto-field 'f) #f))
((dynamic-require ''uses-mutator-with-an-auto-field 'f) #f))
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Make sure that the optimizer doesn't discard a known error on the
;; right-hand side of a `letrec`
(err/rt-test
(letrec-values ([() (list (3) the-val)]
[(the-val) 42])
777)
exn:fail:contract?)
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

View File

@ -7136,7 +7136,7 @@ static Scheme_Object *optimize_lets(Scheme_Object *form, Optimize_Info *info, in
(values (if id e1 e2) ...) and then split the values call, since
duplicating the id use and test is likely to pay off. */
if ((pre_body->count != 1)
&& (found_escapes
&& ((!is_rec && found_escapes)
|| (is_values_apply(value, pre_body->count, rhs_info, merge_skip_vars, 1)
&& ((!is_rec && no_mutable_bindings(pre_body))
/* If the right-hand side is omittable, then there are