Skip to content

Commit

Permalink
varalloc: system calls do modify the stack pointer
Browse files Browse the repository at this point in the history
  • Loading branch information
vbgl authored and eponier committed Sep 9, 2024
1 parent 1d4692b commit c41ad80
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
([PR #888](https://github.com/jasmin-lang/jasmin/pull/888));
fixes [#887](https://github.com/jasmin-lang/jasmin/issues/887)).

- Fix compilation of functions with system calls but not making other use of
the stack
([PR #892](https://github.com/jasmin-lang/jasmin/pull/892));
fixes [#870](https://github.com/jasmin-lang/jasmin/issues/870)).

## Other changes

- The deprecated legacy interface to the LATEX pretty-printer has been removed
Expand Down
4 changes: 2 additions & 2 deletions compiler/src/varalloc.ml
Original file line number Diff line number Diff line change
Expand Up @@ -425,8 +425,8 @@ let alloc_stack_fd callstyle pd get_info gtbl fd =

let sao_alloc = List.iter (Hv.remove lalloc) fd.f_args; lalloc in

let sao_modify_rsp =
sao_size <> 0 || ra_on_stack ||
let sao_modify_rsp =
sao_size <> 0 || has_syscall fd.f_body ||
Sf.exists (fun fn -> (get_info fn).sao_modify_rsp) sao_calls in
let sao = {
sao_calls;
Expand Down
5 changes: 5 additions & 0 deletions compiler/tests/success/common/bug_870.jazz
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export
fn rand(reg ptr u8[32] io) -> reg ptr u8[32] {
io = #randombytes(io);
return io;
}

0 comments on commit c41ad80

Please sign in to comment.