[compiler-rt] r200751 - [ASan] Fix printf-5.c on OSX: fix a compiler warning, avoid intercepting memcpy (which triggers the error report before printf does).

Alexander Potapenko glider at google.com
Tue Feb 4 02:36:56 PST 2014


Author: glider
Date: Tue Feb  4 04:36:55 2014
New Revision: 200751

URL: http://llvm.org/viewvc/llvm-project?rev=200751&view=rev
Log:
[ASan] Fix printf-5.c on OSX: fix a compiler warning, avoid intercepting memcpy (which triggers the error report before printf does).


Modified:
    compiler-rt/trunk/lib/asan/lit_tests/TestCases/printf-5.c

Modified: compiler-rt/trunk/lib/asan/lit_tests/TestCases/printf-5.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/lit_tests/TestCases/printf-5.c?rev=200751&r1=200750&r2=200751&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/lit_tests/TestCases/printf-5.c (original)
+++ compiler-rt/trunk/lib/asan/lit_tests/TestCases/printf-5.c Tue Feb  4 04:36:55 2014
@@ -1,7 +1,8 @@
 // RUN: %clang_asan -O2 %s -o %t
-// RUN: ASAN_OPTIONS=check_printf=1 not %t 2>&1 | FileCheck --check-prefix=CHECK-ON %s
-// RUN: ASAN_OPTIONS=check_printf=0 %t 2>&1 | FileCheck --check-prefix=CHECK-OFF %s
-// RUN: %t 2>&1 | FileCheck --check-prefix=CHECK-OFF %s
+// We need replace_intrin=0 to avoid reporting errors in memcpy.
+// RUN: ASAN_OPTIONS=replace_intrin=0:check_printf=1 not %t 2>&1 | FileCheck --check-prefix=CHECK-ON %s
+// RUN: ASAN_OPTIONS=replace_intrin=0:check_printf=0 %t 2>&1 | FileCheck --check-prefix=CHECK-OFF %s
+// RUN: ASAN_OPTIONS=replace_intrin=0 %t 2>&1 | FileCheck --check-prefix=CHECK-OFF %s
 
 #include <stdio.h>
 #include <string.h>
@@ -12,7 +13,7 @@ int main() {
   volatile char s[] = "34";
   volatile char fmt[2];
   memcpy((char *)fmt, "%c %d %f %s\n", sizeof(fmt));
-  printf(fmt, c, x, f, s);
+  printf((char *)fmt, c, x, f, s);
   return 0;
   // Check that format string is sanitized.
   // CHECK-ON: stack-buffer-overflow





More information about the llvm-commits mailing list