xref: /llvm-project/compiler-rt/test/dfsan/vararg.c (revision 975327a609e55ad9c53bfeee63443128ce20006c)
1 // RUN: %clang_dfsan %s -o %t
2 // RUN: not %run %t 2>&1 | FileCheck %s
3 // RUN: %run %t foo
4 
5 #include <stdio.h>
6 
do_nothing(const char * format,...)7 int do_nothing(const char *format, ...) {
8   return 0;
9 }
10 
main(int argc,char ** argv)11 int main(int argc, char **argv) {
12   int (*fp)(const char *, ...);
13 
14   if (argc > 1)
15     fp = do_nothing;
16   else
17     fp = printf;
18 
19   // CHECK: FATAL: DataFlowSanitizer: unsupported indirect call to vararg function printf
20   fp("hello %s\n", "world");
21 }
22