brintos

brintos / llvm-project-archived public Read only

0
0
Text · 503 B · b1e02b9 Raw
18 lines · c
1// RUN: %clang_msan -O0 %s -o %t && %run %t >%t.out 2>&12// RUN: %clang_msan -O1 %s -o %t && %run %t >%t.out 2>&13// RUN: %clang_msan -O2 %s -o %t && %run %t >%t.out 2>&14// RUN: %clang_msan -O3 %s -o %t && %run %t >%t.out 2>&15 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