blob: 7ad12314f3df03d6a9807ae86541e9e85eb44d0f [file] [log] [blame]
Roman Lebedevb98a0c72019-11-27 17:07:06 +03001// RUN: %clang_cc1 -fsanitize=implicit-unsigned-integer-truncation -fsanitize-recover=implicit-unsigned-integer-truncation -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck %s -implicit-check-not="call void @__ubsan_handle_implicit_conversion" --check-prefixes=CHECK
2
3// CHECK-LABEL: @t0(
4unsigned short t0(unsigned short x) {
5#line 100
6 x++;
7 return x;
8}
9// CHECK-LABEL: @t1(
10unsigned short t1(unsigned short x) {
11#line 200
12 x--;
13 return x;
14}
15// CHECK-LABEL: @t2(
16unsigned short t2(unsigned short x) {
17#line 300
18 ++x;
19 return x;
20}
21// CHECK-LABEL: @t3(
22unsigned short t3(unsigned short x) {
23#line 400
24 --x;
25 return x;
26}
27
28// CHECK-LABEL: @t4(
29signed short t4(signed short x) {
30#line 500
31 x++;
32 return x;
33}
34// CHECK-LABEL: @t5(
35signed short t5(signed short x) {
36#line 600
37 x--;
38 return x;
39}
40// CHECK-LABEL: @t6(
41signed short t6(signed short x) {
42#line 700
43 ++x;
44 return x;
45}
46// CHECK-LABEL: @t7(
47signed short t7(signed short x) {
48#line 800
49 --x;
50 return x;
51}
52
53// CHECK-LABEL: @t8(
54unsigned char t8(unsigned char x) {
55#line 900
56 x++;
57 return x;
58}
59// CHECK-LABEL: @t9(
60unsigned char t9(unsigned char x) {
61#line 1000
62 x--;
63 return x;
64}
65// CHECK-LABEL: @t10(
66unsigned char t10(unsigned char x) {
67#line 1100
68 ++x;
69 return x;
70}
71// CHECK-LABEL: @t11(
72unsigned char t11(unsigned char x) {
73#line 1200
74 --x;
75 return x;
76}
77
78// CHECK-LABEL: @t12(
79signed char t12(signed char x) {
80#line 1300
81 x++;
82 return x;
83}
84// CHECK-LABEL: @t13(
85signed char t13(signed char x) {
86#line 1400
87 x--;
88 return x;
89}
90// CHECK-LABEL: @t14(
91signed char t14(signed char x) {
92#line 1500
93 ++x;
94 return x;
95}
96// CHECK-LABEL: @t15(
97signed char t15(signed char x) {
98#line 1600
99 --x;
100 return x;
101}