Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions compiler-rt/lib/rtsan/rtsan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,7 @@ static void OnViolation(const BufferedStackTrace &stack,
StackDepotHandle handle = StackDepotPut_WithHandle(stack);

const bool is_stack_novel = handle.use_count() == 0;

// Marked UNLIKELY as if user is runing with halt_on_error=false
// we expect a high number of duplicate stacks. We are willing
// To pay for the first insertion.
if (UNLIKELY(is_stack_novel)) {
if (is_stack_novel || !flags().suppress_equal_stacks) {
IncrementUniqueErrorCount();

{
Expand Down
3 changes: 3 additions & 0 deletions compiler-rt/lib/rtsan/rtsan_flags.inc
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@
RTSAN_FLAG(bool, halt_on_error, true, "Exit after first reported error.")
RTSAN_FLAG(bool, print_stats_on_exit, false, "Print stats on exit.")
RTSAN_FLAG(const char *, suppressions, "", "Suppressions file name.")
RTSAN_FLAG(bool, suppress_equal_stacks, true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

equal => duplicate, maybe?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do agree duplicate is clearer, but this would move away from matching tsan - do we care?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, let's keep it the same as TSan.

"Suppress a report if we've already output another report "
"with the same stack.")
4 changes: 4 additions & 0 deletions compiler-rt/test/rtsan/deduplicate_errors.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// RUN: %clangxx -fsanitize=realtime %s -o %t
// RUN: env RTSAN_OPTIONS="halt_on_error=false,print_stats_on_exit=true" %run %t 2>&1 | FileCheck %s
// RUN: env RTSAN_OPTIONS="halt_on_error=false,suppress_equal_stacks=false" %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-DUPLICATES

// UNSUPPORTED: ios

Expand Down Expand Up @@ -37,3 +38,6 @@ int main() {
// CHECK: RealtimeSanitizer exit stats:
// CHECK-NEXT: Total error count: 220
// CHECK-NEXT: Unique error count: 4

// CHECK-DUPLICATES-COUNT-220: ==ERROR:
// CHECK-DUPLICATES-NOT: ==ERROR:
Loading