From dbeb7757c84716d411a3afc875b5acb519fc7227 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96mercan=20Yazici?= Date: Fri, 31 Jan 2025 10:50:36 +0100 Subject: [PATCH 1/2] Return safely when errors during compile occur. --- src/jit.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/jit.cpp b/src/jit.cpp index 4890b02d..a83f6ad3 100644 --- a/src/jit.cpp +++ b/src/jit.cpp @@ -68,8 +68,10 @@ struct JIT { if (!::compile( { "runtime", module_name }, { std::string(runtime_srcs), program_str }, - thorin.world(), std::cerr)) + thorin.world(), std::cerr)) { error("JIT: error while compiling sources"); + return -1; + } thorin.opt(); From ce48acce1a6d38b69c9eefd433f4c82745b6213b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96mercan=20Yazici?= Date: Fri, 31 Jan 2025 11:10:25 +0100 Subject: [PATCH 2/2] call to `error` behaves like `fatal` and aborts the application. Prevent `abort()` for that line. --- src/jit.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/jit.cpp b/src/jit.cpp index a83f6ad3..4382d5c2 100644 --- a/src/jit.cpp +++ b/src/jit.cpp @@ -69,7 +69,7 @@ struct JIT { { "runtime", module_name }, { std::string(runtime_srcs), program_str }, thorin.world(), std::cerr)) { - error("JIT: error while compiling sources"); + print(std::cerr, "JIT: error while compiling sources"); return -1; }