Fix leaking arg slots on tail calls. Closes #160.
This commit is contained in:
parent
67aa39e1ef
commit
bc646d01c5
@ -533,6 +533,7 @@ TEST_XFAILS_LLVM := $(TASK_XFAILS) \
|
||||
str-concat.rs \
|
||||
str-idx.rs \
|
||||
tag.rs \
|
||||
tail-call-arg-leak.rs \
|
||||
tail-cps.rs \
|
||||
tail-direct.rs \
|
||||
task-comm.rs \
|
||||
|
@ -4219,6 +4219,8 @@ let trans_visitor
|
||||
(Printf.sprintf "copy args for tail call to %s" (logname ())));
|
||||
copy_fn_args true true CLONE_none call;
|
||||
drop_slots_at_curr_stmt();
|
||||
iflog (fun _ -> annotate "drop args");
|
||||
iter_arg_slots cx (current_fn()) callee_drop_slot;
|
||||
abi.Abi.abi_emit_fn_tail_call (emitter())
|
||||
(force_sz (current_fn_callsz()))
|
||||
caller_argsz callee_code callee_argsz;
|
||||
|
11
src/test/run-pass/tail-call-arg-leak.rs
Normal file
11
src/test/run-pass/tail-call-arg-leak.rs
Normal file
@ -0,0 +1,11 @@
|
||||
// use of tail calls causes arg slot leaks, issue #160.
|
||||
|
||||
fn inner(str dummy, bool b) {
|
||||
if (b) {
|
||||
be inner(dummy, false);
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
inner("hi", true);
|
||||
}
|
Loading…
Reference in New Issue
Block a user