Skip to content

Commit 41dde17

Browse files
committed
LLVM: take into account the exit code in Stop
1 parent a27725e commit 41dde17

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/libasr/codegen/asr_to_llvm.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3472,12 +3472,11 @@ class ASRToLLVMVisitor : public ASR::BaseVisitor<ASRToLLVMVisitor>
34723472
printf(context, *module, *builder, printf_args);
34733473
}
34743474

3475-
void visit_Stop(const ASR::Stop_t & /* x */) {
3475+
void visit_Stop(const ASR::Stop_t &x) {
34763476
llvm::Value *fmt_ptr = builder->CreateGlobalStringPtr("STOP\n");
34773477
printf(context, *module, *builder, {fmt_ptr});
3478-
int exit_code_int = 0;
3479-
llvm::Value *exit_code = llvm::ConstantInt::get(context,
3480-
llvm::APInt(32, exit_code_int));
3478+
this->visit_expr(*x.m_code);
3479+
llvm::Value *exit_code = tmp;
34813480
exit(context, *module, *builder, exit_code);
34823481
}
34833482

0 commit comments

Comments
 (0)