1 // RUN: %clangxx_cfi_dso -DSHARED_LIB %s -fPIC -shared -o %t-so.so 2 // RUN: %clangxx_cfi_dso %s -o %t %t-so.so && %expect_crash %t 2>&1 | FileCheck %s 3 4 #include <stdio.h> 5 6 #ifdef SHARED_LIB 7 void g(); f()8void f() { 9 // CHECK: =1= 10 fprintf(stderr, "=1=\n"); 11 ((void (*)(void))g)(); 12 // CHECK: =2= 13 fprintf(stderr, "=2=\n"); 14 ((void (*)(int))g)(42); // UB here 15 // CHECK-NOT: =3= 16 fprintf(stderr, "=3=\n"); 17 } 18 #else 19 void f(); g()20void g() { 21 } 22 main()23int main() { 24 f(); 25 } 26 #endif 27