Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

varalloc: system calls do modify the stack pointer #892

Merged
merged 1 commit into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
}