Merge pull request #2795 from rtfeldman/i/2582

Deal with fastcc return-by-pointer convention correctly
This commit is contained in:
Richard Feldman 2022-04-04 20:14:49 -04:00 committed by GitHub
commit b35cc6ac8c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View file

@ -3896,8 +3896,10 @@ fn make_exception_catching_wrapper<'a, 'ctx, 'env>(
let argument_types = match RocReturn::from_layout(env, &return_layout) {
RocReturn::Return => roc_function_type.get_param_types(),
RocReturn::ByPointer => {
// Our fastcc passes the return pointer as the last parameter.
// Remove the return pointer since we now intend to return the result by value.
let mut types = roc_function_type.get_param_types();
types.remove(0);
types.pop();
types
}