fix a mismatch between the optimizer and validator

Thanks to Leif for the report and test case.
This commit is contained in:
Matthew Flatt 2017-01-18 15:35:24 -07:00
parent ecaa14544f
commit 80e8e0f9e0
2 changed files with 17 additions and 1 deletions

View File

@ -5705,6 +5705,22 @@
'bar)))
bar)
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Check that `string-append` on a known-string argument
;; is not treated consistently by the optimzier and
;; validator
(let ([c (compile
'(module m racket/base
(define ill
(let ((base (string-append "a")))
(λ (x) (string-append base x))))
(ill "b")))])
(define o (open-output-bytes))
(write c o)
(parameterize ([read-accept-compiled #t])
(void (read (open-input-bytes (get-output-bytes o))))))
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(report-errs)

View File

@ -8737,7 +8737,7 @@ module_optimize(Scheme_Object *data, Optimize_Info *info, int context)
if (n == 1) {
if (scheme_ir_propagate_ok(e, info))
cnst = 1;
else if (scheme_is_statically_proc(e, info, 0)) {
else if (scheme_is_statically_proc(e, info, OMITTABLE_IGNORE_APPN_OMIT)) {
cnst = 1;
sproc = 1;
}