[compiler-rt] [asan][test] Return success from the Windows CRT initializer (PR #226341)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 24 19:54:27 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-compiler-rt-sanitizer
Author: kingakasa
<details>
<summary>Changes</summary>
The test puts call_me_maybe in .CRT$XIB, but declares both the callback and its pointer type as returning void. The CRT's C-initializer sequence expects an int-returning callback, with zero indicating successful initialization.
Change the pointer type and callback to return int, and return zero explicitly. This makes startup independent of an indeterminate return value.
Validation: crt_initializers.cpp passes independently with both dynamic and static CRT configurations. The original test also passes on this baseline; the change corrects the callback contract rather than claiming a newly reproduced failure.
Tested independently on Windows x64 using a fresh Release LLVM/Clang build with assertions enabled and a matching Release ASan runtime, based on `6dc4a4ba2850369afd537001377fb9d404653d26`.
Changed-line clang-format and git diff --check pass.
Assisted-by: OpenAI Codex
---
Full diff: https://github.com/llvm/llvm-project/pull/226341.diff
1 Files Affected:
- (modified) compiler-rt/test/asan/TestCases/Windows/crt_initializers.cpp (+2-2)
``````````diff
diff --git a/compiler-rt/test/asan/TestCases/Windows/crt_initializers.cpp b/compiler-rt/test/asan/TestCases/Windows/crt_initializers.cpp
index 5a1eee33e70111..8e29cfb3ed5a12 100644
--- a/compiler-rt/test/asan/TestCases/Windows/crt_initializers.cpp
+++ b/compiler-rt/test/asan/TestCases/Windows/crt_initializers.cpp
@@ -5,7 +5,7 @@
#include <stdio.h>
-typedef void (*FPTR)();
+typedef int (*FPTR)();
// __xi_a and __xi_z are defined in VC/crt/src/crt0dat.c
// and are located in .CRT$XIA and .CRT$XIZ respectively.
@@ -24,7 +24,7 @@ int main() {
// CHECK: Number of nonzero CRT initializers
}
-void call_me_maybe() {}
+int call_me_maybe() { return 0; }
#pragma data_seg(".CRT$XIB")
// Add an initializer that shouldn't get its own redzone.
``````````
</details>
https://github.com/llvm/llvm-project/pull/226341
More information about the llvm-commits
mailing list