-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[NFC][clang] Update ubsan-trap-merge.c test to show absence of nomerge in non-trap mode #119280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
1b3a647
[NFC][clang] Add ubsan-handler-merge.c test to show absence of nomerge
thurstond 5441f68
Merge ubsan-trap-merge.c with ubsan-handler-merge.c, and test min-rt,
thurstond 6e027cb
Remove unnecessary metadata check
thurstond 32d541c
no \
vitalybuka 2d4a3e6
reorder command line args
vitalybuka b598c47
allign
vitalybuka File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,113 @@ | ||
| // NOTE: Assertions have mostly been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 5 | ||
| // The most important assertion is the attributes at the end of the file, which | ||
| // shows that -ubsan-unique-traps does not attach 'nomerge' to each ubsan handler. | ||
| // | ||
| // RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -fsanitize=signed-integer-overflow -O3 -mllvm -ubsan-unique-traps %s -o - \ | ||
vitalybuka marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| // RUN: | FileCheck %s | ||
| // | ||
| // REQUIRES: x86-registered-target | ||
|
|
||
| // CHECK-LABEL: define dso_local range(i32 -2147483523, -2147483648) i32 @f( | ||
| // CHECK-SAME: i32 noundef [[X:%.*]]) local_unnamed_addr #[[ATTR0:[0-9]+]] { | ||
| // CHECK-NEXT: [[ENTRY:.*:]] | ||
| // CHECK-NEXT: [[TMP0:%.*]] = tail call { i32, i1 } @llvm.sadd.with.overflow.i32(i32 [[X]], i32 125), !nosanitize [[META2:![0-9]+]] | ||
| // CHECK-NEXT: [[TMP1:%.*]] = extractvalue { i32, i1 } [[TMP0]], 1, !nosanitize [[META2]] | ||
| // CHECK-NEXT: br i1 [[TMP1]], label %[[HANDLER_ADD_OVERFLOW:.*]], label %[[CONT:.*]], !prof [[PROF3:![0-9]+]], !nosanitize [[META2]] | ||
| // CHECK: [[HANDLER_ADD_OVERFLOW]]: | ||
| // CHECK-NEXT: [[TMP2:%.*]] = zext nneg i32 [[X]] to i64, !nosanitize [[META2]] | ||
| // CHECK-NEXT: tail call void @__ubsan_handle_add_overflow_abort(ptr nonnull @[[GLOB1:[0-9]+]], i64 [[TMP2]], i64 125) #[[ATTR4:[0-9]+]], !nosanitize [[META2]] | ||
| // CHECK-NEXT: unreachable, !nosanitize [[META2]] | ||
| // CHECK: [[CONT]]: | ||
| // CHECK-NEXT: [[TMP3:%.*]] = extractvalue { i32, i1 } [[TMP0]], 0, !nosanitize [[META2]] | ||
| // CHECK-NEXT: ret i32 [[TMP3]] | ||
| // | ||
| int f(int x) { | ||
| return x + 125; | ||
| } | ||
|
|
||
| // CHECK-LABEL: define dso_local range(i32 -2147483521, -2147483648) i32 @g( | ||
| // CHECK-SAME: i32 noundef [[X:%.*]]) local_unnamed_addr #[[ATTR0]] { | ||
| // CHECK-NEXT: [[ENTRY:.*:]] | ||
| // CHECK-NEXT: [[TMP0:%.*]] = tail call { i32, i1 } @llvm.sadd.with.overflow.i32(i32 [[X]], i32 127), !nosanitize [[META2]] | ||
| // CHECK-NEXT: [[TMP1:%.*]] = extractvalue { i32, i1 } [[TMP0]], 1, !nosanitize [[META2]] | ||
| // CHECK-NEXT: br i1 [[TMP1]], label %[[HANDLER_ADD_OVERFLOW:.*]], label %[[CONT:.*]], !prof [[PROF3]], !nosanitize [[META2]] | ||
| // CHECK: [[HANDLER_ADD_OVERFLOW]]: | ||
| // CHECK-NEXT: [[TMP2:%.*]] = zext nneg i32 [[X]] to i64, !nosanitize [[META2]] | ||
| // CHECK-NEXT: tail call void @__ubsan_handle_add_overflow_abort(ptr nonnull @[[GLOB2:[0-9]+]], i64 [[TMP2]], i64 127) #[[ATTR4]], !nosanitize [[META2]] | ||
| // CHECK-NEXT: unreachable, !nosanitize [[META2]] | ||
| // CHECK: [[CONT]]: | ||
| // CHECK-NEXT: [[TMP3:%.*]] = extractvalue { i32, i1 } [[TMP0]], 0, !nosanitize [[META2]] | ||
| // CHECK-NEXT: ret i32 [[TMP3]] | ||
| // | ||
| int g(int x) { | ||
| return x + 127; | ||
| } | ||
|
|
||
| // CHECK-LABEL: define dso_local range(i32 -2147483521, -2147483648) i32 @h( | ||
| // CHECK-SAME: i32 noundef [[X:%.*]], i32 noundef [[Y:%.*]]) local_unnamed_addr #[[ATTR0]] { | ||
| // CHECK-NEXT: [[ENTRY:.*:]] | ||
| // CHECK-NEXT: [[TMP0:%.*]] = tail call { i32, i1 } @llvm.sadd.with.overflow.i32(i32 [[X]], i32 127), !nosanitize [[META2]] | ||
| // CHECK-NEXT: [[TMP1:%.*]] = extractvalue { i32, i1 } [[TMP0]], 1, !nosanitize [[META2]] | ||
| // CHECK-NEXT: br i1 [[TMP1]], label %[[HANDLER_ADD_OVERFLOW:.*]], label %[[CONT:.*]], !prof [[PROF3]], !nosanitize [[META2]] | ||
| // CHECK: [[HANDLER_ADD_OVERFLOW]]: | ||
| // CHECK-NEXT: [[TMP2:%.*]] = zext nneg i32 [[X]] to i64, !nosanitize [[META2]] | ||
| // CHECK-NEXT: tail call void @__ubsan_handle_add_overflow_abort(ptr nonnull @[[GLOB3:[0-9]+]], i64 [[TMP2]], i64 127) #[[ATTR4]], !nosanitize [[META2]] | ||
| // CHECK-NEXT: unreachable, !nosanitize [[META2]] | ||
| // CHECK: [[CONT]]: | ||
| // CHECK-NEXT: [[TMP3:%.*]] = tail call { i32, i1 } @llvm.sadd.with.overflow.i32(i32 [[Y]], i32 129), !nosanitize [[META2]] | ||
| // CHECK-NEXT: [[TMP4:%.*]] = extractvalue { i32, i1 } [[TMP3]], 1, !nosanitize [[META2]] | ||
| // CHECK-NEXT: br i1 [[TMP4]], label %[[HANDLER_ADD_OVERFLOW1:.*]], label %[[CONT2:.*]], !prof [[PROF3]], !nosanitize [[META2]] | ||
| // CHECK: [[HANDLER_ADD_OVERFLOW1]]: | ||
| // CHECK-NEXT: [[TMP5:%.*]] = zext nneg i32 [[Y]] to i64, !nosanitize [[META2]] | ||
| // CHECK-NEXT: tail call void @__ubsan_handle_add_overflow_abort(ptr nonnull @[[GLOB4:[0-9]+]], i64 [[TMP5]], i64 129) #[[ATTR4]], !nosanitize [[META2]] | ||
| // CHECK-NEXT: unreachable, !nosanitize [[META2]] | ||
| // CHECK: [[CONT2]]: | ||
| // CHECK-NEXT: [[TMP6:%.*]] = extractvalue { i32, i1 } [[TMP3]], 0, !nosanitize [[META2]] | ||
| // CHECK-NEXT: [[TMP7:%.*]] = extractvalue { i32, i1 } [[TMP0]], 0, !nosanitize [[META2]] | ||
| // CHECK-NEXT: [[COND:%.*]] = tail call i32 @llvm.smin.i32(i32 [[TMP7]], i32 [[TMP6]]) | ||
| // CHECK-NEXT: ret i32 [[COND]] | ||
| // | ||
| int h(int x, int y) { | ||
| x += 127; | ||
| y += 129; | ||
| return x < y ? x : y; | ||
| } | ||
|
|
||
| // CHECK-LABEL: define dso_local noundef i32 @m( | ||
| // CHECK-SAME: i32 noundef [[X:%.*]], i32 noundef [[Y:%.*]]) local_unnamed_addr #[[ATTR0]] { | ||
| // CHECK-NEXT: [[ENTRY:.*:]] | ||
| // CHECK-NEXT: [[TMP0:%.*]] = tail call { i32, i1 } @llvm.sadd.with.overflow.i32(i32 [[X]], i32 125), !nosanitize [[META2]] | ||
| // CHECK-NEXT: [[TMP1:%.*]] = extractvalue { i32, i1 } [[TMP0]], 1, !nosanitize [[META2]] | ||
| // CHECK-NEXT: br i1 [[TMP1]], label %[[HANDLER_ADD_OVERFLOW_I:.*]], label %[[F_EXIT:.*]], !prof [[PROF3]], !nosanitize [[META2]] | ||
| // CHECK: [[HANDLER_ADD_OVERFLOW_I]]: | ||
| // CHECK-NEXT: [[TMP2:%.*]] = zext nneg i32 [[X]] to i64, !nosanitize [[META2]] | ||
| // CHECK-NEXT: tail call void @__ubsan_handle_add_overflow_abort(ptr nonnull @[[GLOB1]], i64 [[TMP2]], i64 125) #[[ATTR4]], !nosanitize [[META2]] | ||
| // CHECK-NEXT: unreachable, !nosanitize [[META2]] | ||
| // CHECK: [[F_EXIT]]: | ||
| // CHECK-NEXT: [[TMP3:%.*]] = extractvalue { i32, i1 } [[TMP0]], 0, !nosanitize [[META2]] | ||
| // CHECK-NEXT: [[TMP4:%.*]] = tail call { i32, i1 } @llvm.sadd.with.overflow.i32(i32 [[Y]], i32 127), !nosanitize [[META2]] | ||
| // CHECK-NEXT: [[TMP5:%.*]] = extractvalue { i32, i1 } [[TMP4]], 1, !nosanitize [[META2]] | ||
| // CHECK-NEXT: br i1 [[TMP5]], label %[[HANDLER_ADD_OVERFLOW_I2:.*]], label %[[G_EXIT:.*]], !prof [[PROF3]], !nosanitize [[META2]] | ||
| // CHECK: [[HANDLER_ADD_OVERFLOW_I2]]: | ||
| // CHECK-NEXT: [[TMP6:%.*]] = zext nneg i32 [[Y]] to i64, !nosanitize [[META2]] | ||
| // CHECK-NEXT: tail call void @__ubsan_handle_add_overflow_abort(ptr nonnull @[[GLOB2]], i64 [[TMP6]], i64 127) #[[ATTR4]], !nosanitize [[META2]] | ||
| // CHECK-NEXT: unreachable, !nosanitize [[META2]] | ||
| // CHECK: [[G_EXIT]]: | ||
| // CHECK-NEXT: [[TMP7:%.*]] = extractvalue { i32, i1 } [[TMP4]], 0, !nosanitize [[META2]] | ||
| // CHECK-NEXT: [[TMP8:%.*]] = tail call { i32, i1 } @llvm.sadd.with.overflow.i32(i32 [[TMP3]], i32 [[TMP7]]), !nosanitize [[META2]] | ||
| // CHECK-NEXT: [[TMP9:%.*]] = extractvalue { i32, i1 } [[TMP8]], 1, !nosanitize [[META2]] | ||
| // CHECK-NEXT: br i1 [[TMP9]], label %[[HANDLER_ADD_OVERFLOW:.*]], label %[[CONT:.*]], !prof [[PROF3]], !nosanitize [[META2]] | ||
| // CHECK: [[HANDLER_ADD_OVERFLOW]]: | ||
| // CHECK-NEXT: [[TMP10:%.*]] = zext i32 [[TMP3]] to i64, !nosanitize [[META2]] | ||
| // CHECK-NEXT: [[TMP11:%.*]] = zext i32 [[TMP7]] to i64, !nosanitize [[META2]] | ||
| // CHECK-NEXT: tail call void @__ubsan_handle_add_overflow_abort(ptr nonnull @[[GLOB5:[0-9]+]], i64 [[TMP10]], i64 [[TMP11]]) #[[ATTR4]], !nosanitize [[META2]] | ||
| // CHECK-NEXT: unreachable, !nosanitize [[META2]] | ||
| // CHECK: [[CONT]]: | ||
| // CHECK-NEXT: [[TMP12:%.*]] = extractvalue { i32, i1 } [[TMP8]], 0, !nosanitize [[META2]] | ||
| // CHECK-NEXT: ret i32 [[TMP12]] | ||
| // | ||
| int m(int x, int y) { | ||
| return f(x) + g(y); | ||
| } | ||
| //. | ||
| // CHECK: attributes #[[ATTR4]] = { noreturn nounwind } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.