aboutsummaryrefslogtreecommitdiff
path: root/clang/test/CodeGen/compound-assign-overflow.c
diff options
context:
space:
mode:
authorVedant Kumar <vsk@apple.com>2017-02-25 00:43:36 +0000
committerVedant Kumar <vsk@apple.com>2017-02-25 00:43:36 +0000
commit82ee16beb8fe91b1f78416470faf71922e5efbeb (patch)
treeac6df3f00982ee9525dbdce02bd8dd270eb062fb /clang/test/CodeGen/compound-assign-overflow.c
parent65d2e7f72c6ff9bd6954c31dd5f2757c8c27b88b (diff)
downloadllvm-82ee16beb8fe91b1f78416470faf71922e5efbeb.zip
llvm-82ee16beb8fe91b1f78416470faf71922e5efbeb.tar.gz
llvm-82ee16beb8fe91b1f78416470faf71922e5efbeb.tar.bz2
[ubsan] Omit superflous overflow checks for promoted arithmetic (PR20193)
C requires the operands of arithmetic expressions to be promoted if their types are smaller than an int. Ubsan emits overflow checks when this sort of type promotion occurs, even if there is no way to actually get an overflow with the promoted type. This patch teaches clang how to omit the superflous overflow checks (addressing PR20193). Testing: check-clang and check-ubsan. Differential Revision: https://reviews.llvm.org/D29369 llvm-svn: 296213
Diffstat (limited to 'clang/test/CodeGen/compound-assign-overflow.c')
-rw-r--r--clang/test/CodeGen/compound-assign-overflow.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/clang/test/CodeGen/compound-assign-overflow.c b/clang/test/CodeGen/compound-assign-overflow.c
index f126bb0..92ae249 100644
--- a/clang/test/CodeGen/compound-assign-overflow.c
+++ b/clang/test/CodeGen/compound-assign-overflow.c
@@ -25,11 +25,9 @@ void compaddunsigned() {
// CHECK: @__ubsan_handle_add_overflow(i8* bitcast ({{.*}} @[[LINE_200]] to i8*), {{.*}})
}
-int8_t a, b;
-
// CHECK: @compdiv
void compdiv() {
#line 300
- a /= b;
+ x /= x;
// CHECK: @__ubsan_handle_divrem_overflow(i8* bitcast ({{.*}} @[[LINE_300]] to i8*), {{.*}})
}