Skip to content

[ubsan] Drop terminal "in " from reports without functions #77163

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

Conversation

vitalybuka
Copy link
Collaborator

No description provided.

@llvmbot
Copy link
Member

llvmbot commented Jan 6, 2024

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: Vitaly Buka (vitalybuka)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/77163.diff

2 Files Affected:

  • (modified) compiler-rt/lib/ubsan/ubsan_diag.cpp (+1-1)
  • (modified) compiler-rt/test/ubsan/TestCases/Misc/print_summary.c (+2-2)
diff --git a/compiler-rt/lib/ubsan/ubsan_diag.cpp b/compiler-rt/lib/ubsan/ubsan_diag.cpp
index aac27041531851..67e884e4916c50 100644
--- a/compiler-rt/lib/ubsan/ubsan_diag.cpp
+++ b/compiler-rt/lib/ubsan/ubsan_diag.cpp
@@ -88,7 +88,7 @@ static void MaybeReportErrorSummary(Location Loc, ErrorType Type) {
       AI.file = internal_strdup(SLoc.getFilename());
       AI.line = SLoc.getLine();
       AI.column = SLoc.getColumn();
-      AI.function = internal_strdup("");  // Avoid printing ?? as function name.
+      AI.function = nullptr;
       ReportErrorSummary(ErrorKind, AI, GetSanititizerToolName());
       AI.Clear();
       return;
diff --git a/compiler-rt/test/ubsan/TestCases/Misc/print_summary.c b/compiler-rt/test/ubsan/TestCases/Misc/print_summary.c
index b67a0614dd2f11..17885094b6ad76 100644
--- a/compiler-rt/test/ubsan/TestCases/Misc/print_summary.c
+++ b/compiler-rt/test/ubsan/TestCases/Misc/print_summary.c
@@ -2,8 +2,8 @@
 // RUN: %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-DEFAULT
 // RUN: %env_ubsan_opts=print_summary=0 %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-NO_SUMMARY
 
-// CHECK-DEFAULT: SUMMARY: UndefinedBehaviorSanitizer: {{.*}}
-// CHECK-NO_SUMMARY-NOT: SUMMARY: UndefinedBehaviorSanitizer: {{.*}}
+// CHECK-DEFAULT: SUMMARY: UndefinedBehaviorSanitizer: {{.*}}print_summary.c{{[:0-9 ]*$}}
+// CHECK-NO_SUMMARY-NOT: SUMMARY: UndefinedBehaviorSanitizer:
 
 int main(int argc, char **argv) {
   int arr[argc - 2];

@vitalybuka vitalybuka changed the base branch from users/vitalybuka/spr/main.ubsan-drop-terminal-in-from-reports-without-functions to main January 6, 2024 01:00
@vitalybuka vitalybuka force-pushed the users/vitalybuka/spr/ubsan-drop-terminal-in-from-reports-without-functions branch from d7e838b to f797549 Compare January 6, 2024 01:05
@vitalybuka vitalybuka merged commit 09e0d71 into main Jan 6, 2024
@vitalybuka vitalybuka deleted the users/vitalybuka/spr/ubsan-drop-terminal-in-from-reports-without-functions branch January 6, 2024 01:05
justinfargnoli pushed a commit to justinfargnoli/llvm-project that referenced this pull request Jan 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants