1 // RUN: %clang_cc1 -fsanitize=implicit-signed-integer-truncation,implicit-integer-sign-change -fsanitize-recover=implicit-signed-integer-truncation,implicit-integer-sign-change -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s -implicit-check-not="call void @__ubsan_handle_implicit_conversion" --check-prefixes=CHECK
3 // CHECK-DAG: @[[INT:.*]] = {{.*}} c"'int'\00" }
4 // CHECK-DAG: @[[UNSIGNED_SHORT:.*]] = {{.*}} c"'unsigned short'\00" }
5 // CHECK-DAG: @[[LINE_100:.*]] = {{.*}}, i32 100, i32 4 }, ptr @[[INT]], ptr @[[UNSIGNED_SHORT]], i8 2, i32 0 }
6 // CHECK-DAG: @[[LINE_200:.*]] = {{.*}}, i32 200, i32 4 }, ptr @[[INT]], ptr @[[UNSIGNED_SHORT]], i8 2, i32 0 }
7 // CHECK-DAG: @[[LINE_300:.*]] = {{.*}}, i32 300, i32 3 }, ptr @[[INT]], ptr @[[UNSIGNED_SHORT]], i8 2, i32 0 }
8 // CHECK-DAG: @[[LINE_400:.*]] = {{.*}}, i32 400, i32 3 }, ptr @[[INT]], ptr @[[UNSIGNED_SHORT]], i8 2, i32 0 }
9 // CHECK-DAG: @[[SHORT:.*]] = {{.*}} c"'short'\00" }
10 // CHECK-DAG: @[[LINE_500:.*]] = {{.*}}, i32 500, i32 4 }, ptr @[[INT]], ptr @[[SHORT]], i8 2, i32 0 }
11 // CHECK-DAG: @[[LINE_600:.*]] = {{.*}}, i32 600, i32 4 }, ptr @[[INT]], ptr @[[SHORT]], i8 2, i32 0 }
12 // CHECK-DAG: @[[LINE_700:.*]] = {{.*}}, i32 700, i32 3 }, ptr @[[INT]], ptr @[[SHORT]], i8 2, i32 0 }
13 // CHECK-DAG: @[[LINE_800:.*]] = {{.*}}, i32 800, i32 3 }, ptr @[[INT]], ptr @[[SHORT]], i8 2, i32 0 }
14 // CHECK-DAG: @[[UNSIGNED_CHAR:.*]] = {{.*}} c"'unsigned char'\00" }
15 // CHECK-DAG: @[[LINE_900:.*]] = {{.*}}, i32 900, i32 4 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 2, i32 0 }
16 // CHECK-DAG: @[[LINE_1000:.*]] = {{.*}}, i32 1000, i32 4 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 2, i32 0 }
17 // CHECK-DAG: @[[LINE_1100:.*]] = {{.*}}, i32 1100, i32 3 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 2, i32 0 }
18 // CHECK-DAG: @[[LINE_1200:.*]] = {{.*}}, i32 1200, i32 3 }, ptr @[[INT]], ptr @[[UNSIGNED_CHAR]], i8 2, i32 0 }
19 // CHECK-DAG: @[[SIGNED_CHAR:.*]] = {{.*}} c"'signed char'\00" }
20 // CHECK-DAG: @[[LINE_1300:.*]] = {{.*}}, i32 1300, i32 4 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
21 // CHECK-DAG: @[[LINE_1400:.*]] = {{.*}}, i32 1400, i32 4 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
22 // CHECK-DAG: @[[LINE_1500:.*]] = {{.*}}, i32 1500, i32 3 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
23 // CHECK-DAG: @[[LINE_1600:.*]] = {{.*}}, i32 1600, i32 3 }, ptr @[[INT]], ptr @[[SIGNED_CHAR]], i8 2, i32 0 }
26 unsigned short t0(unsigned short x
) {
27 // CHECK: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_100]]
33 unsigned short t1(unsigned short x
) {
34 // CHECK: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_200]]
40 unsigned short t2(unsigned short x
) {
41 // CHECK: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_300]]
47 unsigned short t3(unsigned short x
) {
48 // CHECK: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_400]]
55 signed short t4(signed short x
) {
56 // CHECK: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_500]]
62 signed short t5(signed short x
) {
63 // CHECK: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_600]]
69 signed short t6(signed short x
) {
70 // CHECK: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_700]]
76 signed short t7(signed short x
) {
77 // CHECK: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_800]]
84 unsigned char t8(unsigned char x
) {
85 // CHECK: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_900]]
91 unsigned char t9(unsigned char x
) {
92 // CHECK: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_1000]]
98 unsigned char t10(unsigned char x
) {
99 // CHECK: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_1100]]
104 // CHECK-LABEL: @t11(
105 unsigned char t11(unsigned char x
) {
106 // CHECK: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_1200]]
112 // CHECK-LABEL: @t12(
113 signed char t12(signed char x
) {
114 // CHECK: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_1300]]
119 // CHECK-LABEL: @t13(
120 signed char t13(signed char x
) {
121 // CHECK: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_1400]]
126 // CHECK-LABEL: @t14(
127 signed char t14(signed char x
) {
128 // CHECK: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_1500]]
133 // CHECK-LABEL: @t15(
134 signed char t15(signed char x
) {
135 // CHECK: call void @__ubsan_handle_implicit_conversion(ptr @[[LINE_1600]]