fix compiler bug related to `#%variable-reference' on local
The first compiler pass didn't properly shift the stack offset when adjusting the context of a varref of a local. Closes PR 12258
This commit is contained in:
parent
f5230d858f
commit
f02ea92250
|
@ -1643,6 +1643,17 @@
|
||||||
(regexp-match #rx"1e[+]?100" (exn-message exn))))
|
(regexp-match #rx"1e[+]?100" (exn-message exn))))
|
||||||
(test (inexact->exact 1e100) (lambda (x) (inexact->exact (fl/ (fl- x 0.0) 1.0))) 1e100)
|
(test (inexact->exact 1e100) (lambda (x) (inexact->exact (fl/ (fl- x 0.0) 1.0))) 1e100)
|
||||||
|
|
||||||
|
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
;; Check that compiler handles shifting `#%variable-reference'
|
||||||
|
|
||||||
|
(test #f
|
||||||
|
'varref-shift
|
||||||
|
(let ()
|
||||||
|
(define (f #:x [x #f]) #f)
|
||||||
|
(define (g #:y [y #f])
|
||||||
|
(begin (f) #f))
|
||||||
|
#f))
|
||||||
|
|
||||||
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
(report-errs)
|
(report-errs)
|
||||||
|
|
|
@ -1745,7 +1745,6 @@ static Scheme_Object *shift_compiled_expression(Scheme_Object *v, int delta, int
|
||||||
switch (SCHEME_TYPE(v)) {
|
switch (SCHEME_TYPE(v)) {
|
||||||
case scheme_compiled_toplevel_type:
|
case scheme_compiled_toplevel_type:
|
||||||
case scheme_compiled_quote_syntax_type:
|
case scheme_compiled_quote_syntax_type:
|
||||||
case scheme_varref_form_type:
|
|
||||||
return v;
|
return v;
|
||||||
case scheme_local_type:
|
case scheme_local_type:
|
||||||
{
|
{
|
||||||
|
@ -1905,6 +1904,18 @@ static Scheme_Object *shift_compiled_expression(Scheme_Object *v, int delta, int
|
||||||
|
|
||||||
return (Scheme_Object *)lh;
|
return (Scheme_Object *)lh;
|
||||||
}
|
}
|
||||||
|
case scheme_varref_form_type:
|
||||||
|
{
|
||||||
|
Scheme_Object *sv;
|
||||||
|
|
||||||
|
sv = shift_compiled_expression(SCHEME_PTR1_VAL(v), delta, skip);
|
||||||
|
SCHEME_PTR1_VAL(v) = sv;
|
||||||
|
|
||||||
|
sv = shift_compiled_expression(SCHEME_PTR2_VAL(v), delta, skip);
|
||||||
|
SCHEME_PTR2_VAL(v) = sv;
|
||||||
|
|
||||||
|
return v;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
scheme_signal_error("internal error: compile-time shift failed: %d", SCHEME_TYPE(v));
|
scheme_signal_error("internal error: compile-time shift failed: %d", SCHEME_TYPE(v));
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -223,6 +223,7 @@ int scheme_omittable_expr(Scheme_Object *o, int vals, int fuel, int resolved,
|
||||||
|| (vtype == scheme_case_lambda_sequence_type)
|
|| (vtype == scheme_case_lambda_sequence_type)
|
||||||
|| (vtype == scheme_case_lambda_sequence_type)
|
|| (vtype == scheme_case_lambda_sequence_type)
|
||||||
|| (vtype == scheme_quote_syntax_type)
|
|| (vtype == scheme_quote_syntax_type)
|
||||||
|
|| (vtype == scheme_varref_form_type)
|
||||||
|| (vtype == scheme_compiled_quote_syntax_type)) {
|
|| (vtype == scheme_compiled_quote_syntax_type)) {
|
||||||
note_match(1, vals, warn_info);
|
note_match(1, vals, warn_info);
|
||||||
return ((vals == 1) || (vals < 0));
|
return ((vals == 1) || (vals < 0));
|
||||||
|
|
Loading…
Reference in New Issue
Block a user