view projects/compiler-rt/test/dfsan/vararg.c @ 181:df311c476dd5

CreateIdentifierInfo in ParseCbC (not yet worked)
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sun, 31 May 2020 12:30:11 +0900
parents f476a9ba4795
children
line wrap: on
line source

// 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");
}