From: Taylor R Campbell Date: Wed, 28 Nov 2018 03:01:22 +0000 (+0000) Subject: Fix miscompilation of default optional parameters. X-Git-Tag: mit-scheme-pucked-10.1.7~3^2~164 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=cc65b1e8919f7d951cba55d6b70741b6931dd176;p=mit-scheme.git Fix miscompilation of default optional parameters. Holdover from days when optional parameters were filled with unassigned reference traps -- LIAR never got the memo. --- diff --git a/src/compiler/fgopt/simapp.scm b/src/compiler/fgopt/simapp.scm index ff285216f..ed7d006a6 100644 --- a/src/compiler/fgopt/simapp.scm +++ b/src/compiler/fgopt/simapp.scm @@ -96,7 +96,7 @@ USA. (operands operands)) (if (not (null? parameters)) (if (null? operands) - (for-each lvalue-unassigned! parameters) + (for-each lvalue-defaulted! parameters) (begin (lvalue-connect! (car parameters) (car operands)) (loop (cdr parameters) (cdr operands))))))) @@ -135,8 +135,8 @@ USA. (eq-set-union* (lvalue-initial-values (car lvalues)) (map lvalue-initial-values (cdr lvalues))))) -(define (lvalue-unassigned! lvalue) - (lvalue-connect! lvalue (make-constant (make-unassigned-reference-trap)))) +(define (lvalue-defaulted! lvalue) + (lvalue-connect! lvalue (make-constant (default-object)))) (define-integrable (lvalue-connect! lvalue rvalue) (if (rvalue/reference? rvalue) diff --git a/tests/runtime/test-optional.scm b/tests/runtime/test-optional.scm index ffb6a7b75..2a1c52478 100644 --- a/tests/runtime/test-optional.scm +++ b/tests/runtime/test-optional.scm @@ -37,8 +37,4 @@ USA. (define (local #!optional arg) (assert-eqv (fixit arg) #!default)) (local)) - ;; Compiler incorrectly passes unassigned reference trap if - ;; argument is never passed. - (if (compiled-procedure? test) - (expect-failure test) - (test)))) + (test)))