From b7c9a4e2e94dd3a9bf849dcc9ad4527d30c78587 Mon Sep 17 00:00:00 2001 From: vssukharev <143204304+vssukharev@users.noreply.github.com> Date: Wed, 20 Aug 2025 22:47:22 +0300 Subject: [PATCH] Several fixes for the compiler (#2422) * Update .gitignore for nix * Fix build failure when compiling with -Werror=maybe-uninitialized * Fix test failure formatting * Add separateDebugInfo to c3c Nix build --- .gitignore | 6 ++++-- lib/std/core/runtime_test.c3 | 1 - nix/default.nix | 5 ++++- src/compiler/llvm_codegen_expr.c | 4 ++-- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 5c2aabbe0..3d5623f87 100644 --- a/.gitignore +++ b/.gitignore @@ -80,8 +80,10 @@ TAGS /.cache/ /compile_commands.json -# 'nix build' resulting symlink +# Nix result +/.envrc +/.direnv/ # macOS .DS_Store @@ -89,4 +91,4 @@ result # tests /test/tmp/* /test/testrun -/test/test_suite_runner \ No newline at end of file +/test/test_suite_runner diff --git a/lib/std/core/runtime_test.c3 b/lib/std/core/runtime_test.c3 index 8848dced9..2d3dc59aa 100644 --- a/lib/std/core/runtime_test.c3 +++ b/lib/std/core/runtime_test.c3 @@ -140,7 +140,6 @@ fn void unmute_output(bool has_error) @local usz log_size = test_context.fake_stdout.seek(0, Seek.CURSOR)!!; if (has_error) { - io::printf("\nTesting %s ", test_context.current_test_name); io::printn(test_context.has_ansi_codes ? "[\e[0;31mFAIL\e[0m]" : "[FAIL]"); } diff --git a/nix/default.nix b/nix/default.nix index cee6d78d7..e8e2bfe53 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -26,7 +26,10 @@ in llvmPackages.stdenv.mkDerivation (_: removeSuffix "\"" ( removePrefix "\"" ( elemAt ( splitString " " foundLine ) 2 ) ); src = ../.; - + + # See https://github.com/symphorien/nixseparatedebuginfod for usage + separateDebugInfo = true; + # Here we substitute GIT_HASH which is not set for cmake in nix builds. # Similar situation is with __DATE__ and __TIME__ macros, which are # set to "Jan 01 1980 00:00:00" by default. diff --git a/src/compiler/llvm_codegen_expr.c b/src/compiler/llvm_codegen_expr.c index f86380748..bc68462e3 100644 --- a/src/compiler/llvm_codegen_expr.c +++ b/src/compiler/llvm_codegen_expr.c @@ -2643,8 +2643,8 @@ static void llvm_emit_slice_values(GenContext *c, Expr *slice, BEValue *parent_r BEValue parent_addr_x; llvm_emit_expr(c, &parent_addr_x, parent_expr); LLVMValueRef parent_load_value = NULL; - LLVMValueRef parent_base; - LLVMValueRef parent_addr; + LLVMValueRef parent_base = NULL; + LLVMValueRef parent_addr = NULL; if (parent_type->type_kind == TYPE_POINTER) { llvm_value_rvalue(c, &parent_addr_x);