[clang] e92fe7a - [test][msan] Update for noundef on retval
Vitaly Buka via cfe-commits
cfe-commits at lists.llvm.org
Sun Dec 4 22:48:09 PST 2022
Author: Vitaly Buka
Date: 2022-12-04T22:47:56-08:00
New Revision: e92fe7af3f9d7a660e026912852c8ce401331c03
URL: https://github.com/llvm/llvm-project/commit/e92fe7af3f9d7a660e026912852c8ce401331c03
DIFF: https://github.com/llvm/llvm-project/commit/e92fe7af3f9d7a660e026912852c8ce401331c03.diff
LOG: [test][msan] Update for noundef on retval
Added:
Modified:
clang/test/CodeGen/sanitize-memory-disable.c
compiler-rt/test/msan/stack-origin2.cpp
Removed:
################################################################################
diff --git a/clang/test/CodeGen/sanitize-memory-disable.c b/clang/test/CodeGen/sanitize-memory-disable.c
index da3593ac973b..865b37ce10ce 100644
--- a/clang/test/CodeGen/sanitize-memory-disable.c
+++ b/clang/test/CodeGen/sanitize-memory-disable.c
@@ -1,6 +1,7 @@
// RUN: %clang -target x86_64-linux-gnu -S -emit-llvm -o - %s | FileCheck -check-prefixes CHECK,WITHOUT %s
// RUN: %clang -target x86_64-linux-gnu -S -emit-llvm -o - %s -fsanitize=memory | FileCheck -check-prefixes CHECK,MSAN %s
// RUN: %clang -target x86_64-linux-gnu -S -emit-llvm -o - %s -fsanitize=kernel-memory | FileCheck -check-prefixes CHECK,KMSAN %s
+// RUN: %clang -target x86_64-linux-gnu -S -emit-llvm -o - %s -fsanitize=memory -fno-sanitize-memory-param-retval | FileCheck -check-prefixes CHECK,MSAN,RETTLS %s
// Instrumented function.
// MSan uses memset(addr, -1, size) to poison allocas and stores shadow of the return value in
@@ -15,7 +16,7 @@
// MSAN: @llvm.memset{{.*}}({{.*}}, i8 -1
// KMSAN: __msan_poison_alloca
// WITHOUT-NOT: __msan_retval_tls
-// MSAN: __msan_retval_tls
+// RETTLS: __msan_retval_tls
// CHECK: ret i32
int instrumented1(int *a) {
volatile char buf[8];
@@ -34,7 +35,7 @@ int instrumented1(int *a) {
// MSAN: @llvm.memset{{.*}}({{.*}}, i8 0
// KMSAN: __msan_unpoison_alloca
// WITHOUT-NOT: __msan_retval_tls
-// MSAN: __msan_retval_tls
+// RETTLS: __msan_retval_tls
// CHECK: ret i32
__attribute__((no_sanitize("memory"))) __attribute__((no_sanitize("kernel-memory"))) int no_false_positives1(int *a) {
volatile char buf[8];
diff --git a/compiler-rt/test/msan/stack-origin2.cpp b/compiler-rt/test/msan/stack-origin2.cpp
index f47a393b0c84..1c9d66a28db2 100644
--- a/compiler-rt/test/msan/stack-origin2.cpp
+++ b/compiler-rt/test/msan/stack-origin2.cpp
@@ -20,17 +20,19 @@
#include <stdlib.h>
-extern "C"
-int f(int depth) {
- if (depth) return f(depth - 1);
+int t;
- int x;
- int *volatile p = &x;
- return *p;
+extern "C" void f(int depth) {
+ if (depth)
+ return f(depth - 1);
+
+ volatile int x;
+ t = x;
}
int main(int argc, char **argv) {
- return f(1);
+ f(1);
+ return t;
// CHECK: WARNING: MemorySanitizer: use-of-uninitialized-value
// CHECK: {{#0 0x.* in main .*stack-origin2.cpp:}}[[@LINE-2]]
More information about the cfe-commits
mailing list