1// RUN: %clang_msan -m64 -O0 %s -o %t && %run %t >%t.out 2>&1
2// RUN: %clang_msan -m64 -O1 %s -o %t && %run %t >%t.out 2>&1
3// RUN: %clang_msan -m64 -O2 %s -o %t && %run %t >%t.out 2>&1
4// RUN: %clang_msan -m64 -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>
11int main(int argc, char **argv) {
12  char buf[] = "abc";
13  char *p = strdup(buf);
14  if (*p)
15    exit(0);
16  return 0;
17}
18