• Home
  • Raw
  • Download

Lines Matching +full:unsigned +full:- +full:integer +full:- +full:overflow

1 // Check -fsanitize=signed-integer-overflow and
2 // -fsanitize=unsigned-integer-overflow with promoted unsigned types
4 // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o - %s \
5 // RUN: -fsanitize=signed-integer-overflow | FileCheck %s --check-prefix=CHECKS
6 // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o - %s \
7 // RUN: -fsanitize=unsigned-integer-overflow | FileCheck %s --check-prefix=CHECKU
9 unsigned short si, sj, sk;
10 unsigned char ci, cj, ck;
12 extern void opaqueshort(unsigned short);
13 extern void opaquechar(unsigned char);
15 // CHECKS-LABEL: define void @testshortadd()
16 // CHECKU-LABEL: define void @testshortadd()
20 …// CHECKS: [[T1:%.*]] = call { i32, i1 } @llvm.sadd.with.overflow.i32(i32 [[T2:%.*]], i32 [… in testshortadd()
21 // CHECKS-NEXT: [[T4:%.*]] = extractvalue { i32, i1 } [[T1]], 0 in testshortadd()
22 // CHECKS-NEXT: [[T5:%.*]] = extractvalue { i32, i1 } [[T1]], 1 in testshortadd()
29 // CHECKU-NOT: llvm.sadd in testshortadd()
30 // CHECKU-NOT: llvm.uadd in testshortadd()
36 // CHECKS-LABEL: define void @testshortsub()
37 // CHECKU-LABEL: define void @testshortsub()
42 …// CHECKS: [[T1:%.*]] = call { i32, i1 } @llvm.ssub.with.overflow.i32(i32 [[T2:%.*]], i32 [… in testshortsub()
43 // CHECKS-NEXT: [[T4:%.*]] = extractvalue { i32, i1 } [[T1]], 0 in testshortsub()
44 // CHECKS-NEXT: [[T5:%.*]] = extractvalue { i32, i1 } [[T1]], 1 in testshortsub()
51 // CHECKU-NOT: llvm.ssub in testshortsub()
52 // CHECKU-NOT: llvm.usub in testshortsub()
55 si = sj - sk; in testshortsub()
58 // CHECKS-LABEL: define void @testshortmul()
59 // CHECKU-LABEL: define void @testshortmul()
64 …// CHECKS: [[T1:%.*]] = call { i32, i1 } @llvm.smul.with.overflow.i32(i32 [[T2:%.*]], i32 [… in testshortmul()
65 // CHECKS-NEXT: [[T4:%.*]] = extractvalue { i32, i1 } [[T1]], 0 in testshortmul()
66 // CHECKS-NEXT: [[T5:%.*]] = extractvalue { i32, i1 } [[T1]], 1 in testshortmul()
73 // CHECKU-NOT: llvm.smul in testshortmul()
74 // CHECKU-NOT: llvm.umul in testshortmul()
79 // CHECKS-LABEL: define void @testcharadd()
80 // CHECKU-LABEL: define void @testcharadd()
85 …// CHECKS: [[T1:%.*]] = call { i32, i1 } @llvm.sadd.with.overflow.i32(i32 [[T2:%.*]], i32 [… in testcharadd()
86 // CHECKS-NEXT: [[T4:%.*]] = extractvalue { i32, i1 } [[T1]], 0 in testcharadd()
87 // CHECKS-NEXT: [[T5:%.*]] = extractvalue { i32, i1 } [[T1]], 1 in testcharadd()
94 // CHECKU-NOT: llvm.sadd in testcharadd()
95 // CHECKU-NOT: llvm.uadd in testcharadd()
101 // CHECKS-LABEL: define void @testcharsub()
102 // CHECKU-LABEL: define void @testcharsub()
107 …// CHECKS: [[T1:%.*]] = call { i32, i1 } @llvm.ssub.with.overflow.i32(i32 [[T2:%.*]], i32 [… in testcharsub()
108 // CHECKS-NEXT: [[T4:%.*]] = extractvalue { i32, i1 } [[T1]], 0 in testcharsub()
109 // CHECKS-NEXT: [[T5:%.*]] = extractvalue { i32, i1 } [[T1]], 1 in testcharsub()
116 // CHECKU-NOT: llvm.ssub in testcharsub()
117 // CHECKU-NOT: llvm.usub in testcharsub()
120 ci = cj - ck; in testcharsub()
123 // CHECKS-LABEL: define void @testcharmul()
124 // CHECKU-LABEL: define void @testcharmul()
129 …// CHECKS: [[T1:%.*]] = call { i32, i1 } @llvm.smul.with.overflow.i32(i32 [[T2:%.*]], i32 [… in testcharmul()
130 // CHECKS-NEXT: [[T4:%.*]] = extractvalue { i32, i1 } [[T1]], 0 in testcharmul()
131 // CHECKS-NEXT: [[T5:%.*]] = extractvalue { i32, i1 } [[T1]], 1 in testcharmul()
138 // CHECKU-NOT: llvm.smul in testcharmul()
139 // CHECKU-NOT: llvm.umul in testcharmul()