1*7c3d14c8STreehugger Robot // RUN: %clang_msan -O0 %s -o %t && %run %t >%t.out 2>&1 2*7c3d14c8STreehugger Robot // RUN: %clang_msan -O1 %s -o %t && %run %t >%t.out 2>&1 3*7c3d14c8STreehugger Robot // RUN: %clang_msan -O2 %s -o %t && %run %t >%t.out 2>&1 4*7c3d14c8STreehugger Robot // RUN: %clang_msan -O3 %s -o %t && %run %t >%t.out 2>&1 5*7c3d14c8STreehugger Robot 6*7c3d14c8STreehugger Robot // Test that strdup in C programs is intercepted. 7*7c3d14c8STreehugger Robot // GLibC headers translate strdup to __strdup at -O1 and higher. 8*7c3d14c8STreehugger Robot 9*7c3d14c8STreehugger Robot #include <stdlib.h> 10*7c3d14c8STreehugger Robot #include <string.h> main(int argc,char ** argv)11*7c3d14c8STreehugger Robotint main(int argc, char **argv) { 12*7c3d14c8STreehugger Robot char buf[] = "abc"; 13*7c3d14c8STreehugger Robot char *p = strdup(buf); 14*7c3d14c8STreehugger Robot if (*p) 15*7c3d14c8STreehugger Robot exit(0); 16*7c3d14c8STreehugger Robot return 0; 17*7c3d14c8STreehugger Robot } 18