150
|
1 // RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -o - %s -fsanitize=function -fno-sanitize-recover=all | FileCheck %s
|
|
2
|
207
|
3 // CHECK-LABEL: define{{.*}} void @_Z3funv() #0 prologue <{ i32, i32 }> <{ i32 846595819, i32 trunc (i64 sub (i64 ptrtoint (i8** @0 to i64), i64 ptrtoint (void ()* @_Z3funv to i64)) to i32) }> {
|
150
|
4 void fun() {}
|
|
5
|
207
|
6 // CHECK-LABEL: define{{.*}} void @_Z6callerPFvvE(void ()* %f)
|
150
|
7 // CHECK: getelementptr <{ i32, i32 }>, <{ i32, i32 }>* {{.*}}, i32 0, i32 0, !nosanitize
|
|
8 // CHECK: load i32, i32* {{.*}}, align {{.*}}, !nosanitize
|
|
9 // CHECK: icmp eq i32 {{.*}}, 846595819, !nosanitize
|
|
10 // CHECK: br i1 {{.*}}, label %[[LABEL1:.*]], label %[[LABEL4:.*]], !nosanitize
|
|
11 // CHECK: [[LABEL1]]:
|
|
12 // CHECK: getelementptr <{ i32, i32 }>, <{ i32, i32 }>* {{.*}}, i32 0, i32 1, !nosanitize
|
|
13 // CHECK: load i32, i32* {{.*}}, align {{.*}}, !nosanitize
|
|
14 // CHECK: icmp eq i8* {{.*}}, bitcast ({ i8*, i8* }* @_ZTIFvvE to i8*), !nosanitize
|
|
15 // CHECK: br i1 {{.*}}, label %[[LABEL3:.*]], label %[[LABEL2:[^,]*]], {{.*}}!nosanitize
|
|
16 // CHECK: [[LABEL2]]:
|
|
17 // CHECK: call void @__ubsan_handle_function_type_mismatch_v1_abort(i8* {{.*}}, i64 {{.*}}, i64 {{.*}}, i64 {{.*}}) #{{.*}}, !nosanitize
|
|
18 // CHECK-NOT: unreachable
|
|
19 // CHECK: br label %[[LABEL3]], !nosanitize
|
|
20 // CHECK: [[LABEL3]]:
|
|
21 // CHECK: br label %[[LABEL4]], !nosanitize
|
|
22 void caller(void (*f)()) { f(); }
|