From cc9889d7abf37de43afb76d7cacb0bf0ae0f57ee Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Tue, 26 Jul 2016 19:37:42 -0600 Subject: [PATCH] fix setup for the letrec-check pass Due to an obvious problem in the setup, the letrec-check pass wasn't running an intended dead-code pruning pass. Correcting the problem cuases one test in "optimize.rktl" to change, because the letrec-check pass can see more in one case than thanother. (Problem discovered by accidentally fixing the setup in a Racket branch based on "linklets".) --- pkgs/racket-test-core/tests/racket/optimize.rktl | 3 ++- racket/src/racket/src/letrec_check.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pkgs/racket-test-core/tests/racket/optimize.rktl b/pkgs/racket-test-core/tests/racket/optimize.rktl index 282228b2d8..23dd811bd7 100644 --- a/pkgs/racket-test-core/tests/racket/optimize.rktl +++ b/pkgs/racket-test-core/tests/racket/optimize.rktl @@ -4450,7 +4450,8 @@ (test-comp '(lambda (f) (letrec ([x (lambda() y)] [y (lambda () x)] [z (error 'error)]) #f)) '(lambda (f) (letrec ([x (lambda() y)] [y (lambda () x)] [z (error 'error)]) (f x y z)) 5)) (test-comp '(lambda (f) (letrec ([x (lambda() y)] [z (error 'error)] [y #f]) #f)) - '(lambda (f) (letrec ([x (lambda() y)] [z (error 'error)] [y (lambda () x)]) (f x y z)) 5)) + '(lambda (f) (letrec ([x (lambda() y)] [z (error 'error)] [y (lambda () x)]) (f x y z)) 5) + #f) ; letrec-check pass determines that the body of `x` is dead (test-comp '(lambda (f) (letrec ([z (error 'error)] [x #f] [y #f]) #f)) '(lambda (f) (letrec ([z (error 'error)] [x (lambda() y)] [y (lambda () x)]) (f x y z)) 5)) diff --git a/racket/src/racket/src/letrec_check.c b/racket/src/racket/src/letrec_check.c index 29ebcb67fc..e656c15ab1 100644 --- a/racket/src/racket/src/letrec_check.c +++ b/racket/src/racket/src/letrec_check.c @@ -1101,7 +1101,7 @@ Scheme_Object *scheme_letrec_check_expr(Scheme_Object *expr) positions. We use a list of numbers for the RHS of a `let[rec]-values` form with multiple variables. */ - val = letrec_check_expr(expr, NULL, init_pos); + val = letrec_check_expr(expr, frame, init_pos); clean_dead_deferred_expr(*frame->deferred_chain);