[llvm-branch-commits] [compiler-rt] [tsan] Fallback to top frame (PR #77145)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Jan 5 14:07:19 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

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

Author: Vitaly Buka (vitalybuka)

<details>
<summary>Changes</summary>

Probably it's not important, as it should not happen,
but if all frames are internal we should pick top, not
the bottom frame.


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


1 Files Affected:

- (modified) compiler-rt/lib/tsan/rtl/tsan_report.cpp (+5-4) 


``````````diff
diff --git a/compiler-rt/lib/tsan/rtl/tsan_report.cpp b/compiler-rt/lib/tsan/rtl/tsan_report.cpp
index cdcc20b9758f48..c6b764bd891752 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_report.cpp
+++ b/compiler-rt/lib/tsan/rtl/tsan_report.cpp
@@ -275,7 +275,7 @@ static ReportStack *ChooseSummaryStack(const ReportDesc *rep) {
 
 static bool FrameIsInternal(const SymbolizedStack *frame) {
   if (!frame)
-    return false;
+    return true;
   const char *file = frame->info.file;
   const char *module = frame->info.module;
   if (file && (internal_strstr(file, "/compiler-rt/lib/")))
@@ -286,9 +286,10 @@ static bool FrameIsInternal(const SymbolizedStack *frame) {
 }
 
 static SymbolizedStack *SkipTsanInternalFrames(SymbolizedStack *frames) {
-  while (FrameIsInternal(frames) && frames->next)
-    frames = frames->next;
-  return frames;
+  for (SymbolizedStack *f = frames; f; f = f->next)
+    if (!FrameIsInternal(f))
+      return f;
+  return frames;  // Fallback to the top frame.
 }
 
 void PrintReport(const ReportDesc *rep) {

``````````

</details>


https://github.com/llvm/llvm-project/pull/77145


More information about the llvm-branch-commits mailing list