1// RUN: %clang -g -fsanitize=function %s -o %t
2// RUN: %run %t 2>&1 | FileCheck %s --check-prefix=CHECK --implicit-check-not='runtime error:'
3
4void f(void (*fp)(int (*)[])) { fp(0); }
5
6void callee0(int (*a)[]) {}
7void callee1(int (*a)[1]) {}
8
9int main() {
10 int a[1];
11 f(fp: callee0);
12 // CHECK: runtime error: call to function callee1 through pointer to incorrect function type 'void (*)(int (*)[])'
13 f(fp: callee1); // compatible type in C, but flagged
14}
15

source code of compiler-rt/test/ubsan/TestCases/TypeCheck/Function/c.c