Home | History | Annotate | Download | only in icall
      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 f() {
      8 }
      9 #else
     10 void f();
     11 int main() {
     12   // CHECK: =1=
     13   fprintf(stderr, "=1=\n");
     14   ((void (*)(void))f)();
     15   // CHECK: =2=
     16   fprintf(stderr, "=2=\n");
     17   ((void (*)(int))f)(42); // UB here
     18   // CHECK-NOT: =3=
     19   fprintf(stderr, "=3=\n");
     20 }
     21 #endif
     22