[compiler-rt] [llvm] [msan] Add experimental '-mllvm -msan-embed-faulting-instruction' and MSAN_OPTIONS=print_faulting_instruction (PR #136539)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Apr 20 23:05:50 PDT 2025
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff HEAD~1 HEAD --extensions cpp,inc,h -- compiler-rt/test/msan/print_faulting_inst.cpp compiler-rt/lib/msan/msan.cpp compiler-rt/lib/msan/msan_flags.inc compiler-rt/lib/msan/msan_interface_internal.h llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/compiler-rt/test/msan/print_faulting_inst.cpp b/compiler-rt/test/msan/print_faulting_inst.cpp
index 1cbea9eb0..7274f4d14 100644
--- a/compiler-rt/test/msan/print_faulting_inst.cpp
+++ b/compiler-rt/test/msan/print_faulting_inst.cpp
@@ -38,7 +38,7 @@
#include <stdio.h>
#include <stdlib.h>
-#define THRICE(o,t) twice(o,t)
+#define THRICE(o, t) twice(o, t)
__attribute__((noinline)) extern "C" int twice(int o, int t) {
return o + t < 3;
@@ -57,7 +57,8 @@ int main(int argc, char *argv[]) {
int index = atoi(argv[1]);
int val = buf[index];
- printf("index %d, abs(val) %d, THRICE(val,5) %d\n", index, abs(val), THRICE(val,5));
+ printf("index %d, abs(val) %d, THRICE(val,5) %d\n", index, abs(val),
+ THRICE(val, 5));
// VERY-VERBOSE-PARAM-CHECK: Instruction that failed the shadow check: %{{.*}} = call noundef i32 @twice(i32 noundef %{{.*}}, i32 noundef 5)
// VERBOSE-PARAM-CHECK: Instruction that failed the shadow check: call twice
// PARAM-CHECK: WARNING: MemorySanitizer: use-of-uninitialized-value
@@ -73,7 +74,7 @@ int main(int argc, char *argv[]) {
printf("Variable is zero\n");
int nextval = buf[index + 1];
- buf[nextval + abs(index)] = twice(index,6);
+ buf[nextval + abs(index)] = twice(index, 6);
// VERY-VERBOSE-STORE-CHECK: Instruction that failed the shadow check: store i32 %{{.*}}, ptr %{{.*}}
// VERBOSE-STORE-CHECK: Instruction that failed the shadow check: store
// STORE-CHECK: WARNING: MemorySanitizer: use-of-uninitialized-value
``````````
</details>
https://github.com/llvm/llvm-project/pull/136539
More information about the llvm-commits
mailing list