[compiler-rt] r205417 - [msan] Add missing test for r205413.

Evgeniy Stepanov eugeni.stepanov at gmail.com
Wed Apr 2 05:38:14 PDT 2014


Author: eugenis
Date: Wed Apr  2 07:38:13 2014
New Revision: 205417

URL: http://llvm.org/viewvc/llvm-project?rev=205417&view=rev
Log:
[msan] Add missing test for r205413.

Added:
    compiler-rt/trunk/test/msan/check_mem_is_initialized.cc   (with props)

Added: compiler-rt/trunk/test/msan/check_mem_is_initialized.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/msan/check_mem_is_initialized.cc?rev=205417&view=auto
==============================================================================
--- compiler-rt/trunk/test/msan/check_mem_is_initialized.cc (added)
+++ compiler-rt/trunk/test/msan/check_mem_is_initialized.cc Wed Apr  2 07:38:13 2014
@@ -0,0 +1,33 @@
+// RUN: %clangxx_msan -m64 -O0 %s -o %t && not %t >%t.out 2>&1
+// RUN: FileCheck %s < %t.out
+// RUN: %clangxx_msan -m64 -O1 %s -o %t && not %t >%t.out 2>&1
+// RUN: FileCheck %s < %t.out
+// RUN: %clangxx_msan -m64 -O2 %s -o %t && not %t >%t.out 2>&1
+// RUN: FileCheck %s < %t.out
+// RUN: %clangxx_msan -m64 -O3 %s -o %t && not %t >%t.out 2>&1
+// RUN: FileCheck %s < %t.out
+
+// RUN: %clangxx_msan -fsanitize-memory-track-origins -m64 -O0 %s -o %t && not %t >%t.out 2>&1
+// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-ORIGINS < %t.out
+// RUN: %clangxx_msan -fsanitize-memory-track-origins -m64 -O1 %s -o %t && not %t >%t.out 2>&1
+// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-ORIGINS < %t.out
+// RUN: %clangxx_msan -fsanitize-memory-track-origins -m64 -O2 %s -o %t && not %t >%t.out 2>&1
+// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-ORIGINS < %t.out
+// RUN: %clangxx_msan -fsanitize-memory-track-origins -m64 -O3 %s -o %t && not %t >%t.out 2>&1
+// RUN: FileCheck %s < %t.out && FileCheck %s --check-prefix=CHECK-ORIGINS < %t.out
+
+#include <sanitizer/msan_interface.h>
+#include <stdlib.h>
+
+int main(int argc, char **argv) {
+  int *volatile p = (int *)malloc(sizeof(int));
+
+  __msan_check_mem_is_initialized(p, sizeof(*p));
+  // CHECK: WARNING: MemorySanitizer: use-of-uninitialized-value
+  // CHECK: {{#0 0x.* in main .*check_mem_is_initialized.cc:}}[[@LINE-2]]
+
+  // CHECK-ORIGINS: Uninitialized value was created by a heap allocation
+  // CHECK-ORIGINS: {{#0 0x.* in .*malloc}}
+  // CHECK-ORIGINS: {{#1 0x.* in main .*check_mem_is_initialized.cc:}}[[@LINE-8]]
+  return 0;
+}

Propchange: compiler-rt/trunk/test/msan/check_mem_is_initialized.cc
------------------------------------------------------------------------------
    svn:eol-style = LF





More information about the llvm-commits mailing list