Mercurial > hg > CbC > CbC_llvm
annotate compiler-rt/test/msan/c-strdup.c @ 222:81f6424ef0e3 llvm-original
LLVM original branch
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 18 Jul 2021 22:10:01 +0900 |
parents | 1d019706d866 |
children |
rev | line source |
---|---|
150 | 1 // RUN: %clang_msan -O0 %s -o %t && %run %t >%t.out 2>&1 |
2 // RUN: %clang_msan -O1 %s -o %t && %run %t >%t.out 2>&1 | |
3 // RUN: %clang_msan -O2 %s -o %t && %run %t >%t.out 2>&1 | |
4 // RUN: %clang_msan -O3 %s -o %t && %run %t >%t.out 2>&1 | |
5 | |
6 // Test that strdup in C programs is intercepted. | |
7 // GLibC headers translate strdup to __strdup at -O1 and higher. | |
8 | |
9 #include <stdlib.h> | |
10 #include <string.h> | |
11 int main(int argc, char **argv) { | |
12 char buf[] = "abc"; | |
13 char *p = strdup(buf); | |
14 if (*p) | |
15 exit(0); | |
16 return 0; | |
17 } |