[compiler-rt] r216542 - [asan] Add asprintf negative test.

Evgeniy Stepanov eugeni.stepanov at gmail.com
Wed Aug 27 05:46:58 PDT 2014


Author: eugenis
Date: Wed Aug 27 07:46:58 2014
New Revision: 216542

URL: http://llvm.org/viewvc/llvm-project?rev=216542&view=rev
Log:
[asan] Add asprintf negative test.

Added:
    compiler-rt/trunk/test/asan/TestCases/Posix/asprintf.cc   (with props)

Added: compiler-rt/trunk/test/asan/TestCases/Posix/asprintf.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/Posix/asprintf.cc?rev=216542&view=auto
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/Posix/asprintf.cc (added)
+++ compiler-rt/trunk/test/asan/TestCases/Posix/asprintf.cc Wed Aug 27 07:46:58 2014
@@ -0,0 +1,20 @@
+// RUN: %clangxx_asan -O0 %s -o %t && %run %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -O3 %s -o %t && %run %t 2>&1 | FileCheck %s
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+
+int main(int argc, char **argv) {
+  char *p;
+  int res = asprintf(&p, "%d", argc);
+  fprintf(stderr, "x%d %sx\n", res, p);
+  // CHECK: x1 1x
+  free(p);
+  fprintf(stderr, "DONE\n");
+  // CHECK: DONE
+  return 0;
+}

Propchange: compiler-rt/trunk/test/asan/TestCases/Posix/asprintf.cc
------------------------------------------------------------------------------
    svn:eol-style = LF





More information about the llvm-commits mailing list