diff options
| author | Eduardo Sánchez Muñoz <esm@eduardosm.net> | 2018-07-14 01:12:23 +0200 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2018-07-14 11:33:01 -0400 |
| commit | 722b9b9e595027e76ab4255f13ad0eca539358ac (patch) | |
| tree | 160a103df662ed026ade45dc536907f022da54cc /src/codegen.cpp | |
| parent | 2a719ee6c598b7096060168a0e7c93ae3e244008 (diff) | |
| download | zig-722b9b9e595027e76ab4255f13ad0eca539358ac.tar.gz zig-722b9b9e595027e76ab4255f13ad0eca539358ac.zip | |
codegen: Store returned value if type is 'handle_is_ptr' and function is not 'first_arg_ret'.
Seems to fix #1230, includes test.
Diffstat (limited to 'src/codegen.cpp')
| -rw-r--r-- | src/codegen.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/codegen.cpp b/src/codegen.cpp index 3f54c120b4..0bcc211164 100644 --- a/src/codegen.cpp +++ b/src/codegen.cpp @@ -3166,6 +3166,10 @@ static LLVMValueRef ir_render_call(CodeGen *g, IrExecutable *executable, IrInstr return nullptr; } else if (first_arg_ret) { return instruction->tmp_ptr; + } else if (handle_is_ptr(src_return_type)) { + auto store_instr = LLVMBuildStore(g->builder, result, instruction->tmp_ptr); + LLVMSetAlignment(store_instr, LLVMGetAlignment(instruction->tmp_ptr)); + return instruction->tmp_ptr; } else { return result; } |
