Skip to content

Commit 0777a3e

Browse files
committed
[Clang][CodeGen] Add miscompilation reproducer
1 parent 6ca21c2 commit 0777a3e

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 5
2+
// RUN: %clang_cc1 -triple armv7-linux-androideabi24 -emit-llvm -fsanitize=signed-integer-overflow -O3 %s -o - -fsanitize-recover=signed-integer-overflow -w | FileCheck %s --check-prefixes=RECOVER
3+
// REQUIRES: aarch64-registered-target
4+
5+
#define LLONG_MIN (-__LONG_LONG_MAX__-1LL)
6+
7+
// RECOVER-LABEL: define dso_local noundef i32 @main(
8+
// RECOVER-SAME: ) local_unnamed_addr #[[ATTR0:[0-9]+]] {
9+
// RECOVER-NEXT: [[ENTRY:.*:]]
10+
// RECOVER-NEXT: [[TMP:%.*]] = alloca i64, align 8
11+
// RECOVER-NEXT: [[TMP0:%.*]] = ptrtoint ptr [[TMP]] to i32, !nosanitize [[META3:![0-9]+]]
12+
// RECOVER-NEXT: call void @__ubsan_handle_negate_overflow(ptr nonnull @[[GLOB1:[0-9]+]], i32 [[TMP0]]) #[[ATTR2:[0-9]+]], !nosanitize [[META3]]
13+
// RECOVER-NEXT: ret i32 0
14+
//
15+
int main() {
16+
__builtin_llabs(LLONG_MIN);
17+
return 0;
18+
}
19+
//.
20+
// RECOVER: [[META3]] = !{}
21+
//.

0 commit comments

Comments
 (0)