From 2e4286846765f950c572f6c7d98126ecc9ede953 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Estanislao=20P=C3=A9rez=20Nartallo?= Date: Fri, 20 Jun 2025 00:55:06 +0200 Subject: [PATCH] Fix error maybe-uninitialized (#2230) * Add build instructions for Arch Linux * Fix error maybe-uninitialized in llvm_codegen_expr.c when compiling with clang 20.1.6 --- README.md | 3 +-- src/compiler/llvm_codegen_expr.c | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 308b902d9..4b44809a4 100644 --- a/README.md +++ b/README.md @@ -379,8 +379,7 @@ The c3c binary should be created in the build directory. You can try it out by r ```bash cmake -B build \ -D C3_LINK_DYNAMIC=ON \ - -D CMAKE_BUILD_TYPE=Release \ - -D CMAKE_C_FLAGS_RELEASE="-Wno-error=maybe-uninitialized" + -D CMAKE_BUILD_TYPE=Release ``` 5. Build the project: `make -C build`. diff --git a/src/compiler/llvm_codegen_expr.c b/src/compiler/llvm_codegen_expr.c index 4acb81ce8..28cb8ded0 100644 --- a/src/compiler/llvm_codegen_expr.c +++ b/src/compiler/llvm_codegen_expr.c @@ -2051,7 +2051,7 @@ static inline LLVMValueRef llvm_emit_inc_dec_value(GenContext *c, SourceSpan spa Type *element = type_lowering(type->array.base); LLVMValueRef diff_value; bool is_integer = type_kind_is_any_integer(element->type_kind); - bool is_ptr; + bool is_ptr = false; if (is_integer) { diff_value = LLVMConstInt(llvm_get_type(c, element), 1, false);