summaryrefslogtreecommitdiff
path: root/test/dfsan/vararg.c
blob: f51e39c718990acdb03e6558e8fd05cbe15ed09c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// RUN: %clang_dfsan %s -o %t
// RUN: not %run %t 2>&1 | FileCheck %s
// RUN: %run %t foo
// RUN: %clang_dfsan -mllvm -dfsan-args-abi %s -o %t
// RUN: not %run %t 2>&1 | FileCheck %s
// RUN: %run %t foo

#include <stdio.h>

int do_nothing(const char *format, ...) {
  return 0;
}

int main(int argc, char **argv) {
  int (*fp)(const char *, ...);

  if (argc > 1)
    fp = do_nothing;
  else
    fp = printf;

  // CHECK: FATAL: DataFlowSanitizer: unsupported indirect call to vararg function printf
  fp("hello %s\n", "world");
}