brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.4 KiB · fb2487c Raw
44 lines · cpp
1// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -o - %s -fsanitize=function -fno-sanitize-recover=all | FileCheck %s --check-prefixes=CHECK,GNU,642// RUN: %clang_cc1 -triple x86_64-pc-windows-msvc -emit-llvm -o - %s -fsanitize=function -fno-sanitize-recover=all | FileCheck %s --check-prefixes=CHECK,MSVC,643// RUN: %clang_cc1 -triple aarch64-linux-gnu -emit-llvm -o - %s -fsanitize=function -fno-sanitize-recover=all | FileCheck %s --check-prefixes=CHECK,GNU,644// RUN: %clang_cc1 -triple aarch64_be-linux-gnu -emit-llvm -o - %s -fsanitize=function -fno-sanitize-recover=all | FileCheck %s --check-prefixes=CHECK,GNU,645// RUN: %clang_cc1 -triple arm-none-eabi -emit-llvm -o - %s -fsanitize=function -fno-sanitize-recover=all | FileCheck %s --check-prefixes=CHECK,ARM,GNU,326 7// GNU:  define{{.*}} void @_Z3funv() #0 !func_sanitize ![[FUNCSAN:.*]] {8// MSVC: define{{.*}} void @"?fun@@YA?A?<auto>@@XZ"() #0 !func_sanitize ![[FUNCSAN:.*]] {9auto fun() {}10 11// GNU-LABEL:  define{{.*}} void @_Z6callerv()12// MSVC-LABEL: define{{.*}} void @"?caller@@YAXXZ"()13// ARM:   ptrtoint ptr {{.*}} to i32, !nosanitize !414// ARM:   and i32 {{.*}}, -2, !nosanitize !415// ARM:   inttoptr i32 {{.*}} to ptr, !nosanitize !416// CHECK: getelementptr <{ i32, i32 }>, ptr {{.*}}, i32 -1, i32 0, !nosanitize17// CHECK: load i32, ptr {{.*}}, align {{.*}}, !nosanitize18// CHECK: icmp eq i32 {{.*}}, -1056584962, !nosanitize19// CHECK: br i1 {{.*}}, label %[[LABEL1:.*]], label %[[LABEL4:.*]], !nosanitize20// CHECK: [[LABEL1]]:21// CHECK: getelementptr <{ i32, i32 }>, ptr {{.*}}, i32 -1, i32 1, !nosanitize22// CHECK: load i32, ptr {{.*}}, align {{.*}}, !nosanitize23// GNU:   icmp eq i32 {{.*}}, 905068220, !nosanitize24// MSVC:  icmp eq i32 {{.*}}, -1600339357, !nosanitize25// CHECK: br i1 {{.*}}, label %[[LABEL3:.*]], label %[[LABEL2:[^,]*]], {{.*}}!nosanitize26// CHECK: [[LABEL2]]:27// 64:    call void @__ubsan_handle_function_type_mismatch_abort(ptr @[[#]], i64 %[[#]]) #[[#]], !nosanitize28// 32:    call void @__ubsan_handle_function_type_mismatch_abort(ptr @[[#]], i32 %[[#]]) #[[#]], !nosanitize29// CHECK-NEXT: unreachable, !nosanitize30// CHECK-EMPTY:31// CHECK-NEXT: [[LABEL3]]:32// CHECK: br label %[[LABEL4]], !nosanitize33// CHECK-EMPTY:34// CHECK-NEXT: [[LABEL4]]:35// CHECK-NEXT:   call void36// CHECK-NEXT:   ret void37void caller() {38  auto a = fun;39  a();40}41 42// GNU:  ![[FUNCSAN]] = !{i32 -1056584962, i32 905068220}43// MSVC: ![[FUNCSAN]] = !{i32 -1056584962, i32 -1600339357}44