[llvm] 7292d05 - [llvm-debuginfo-analyzer] Fix format string-type mismatch in LVScope

Michał Górny via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 4 04:59:14 PDT 2022


Author: Michał Górny
Date: 2022-11-04T12:59:01+01:00
New Revision: 7292d051a94032ea9ea56471ad40cc81696cca5b

URL: https://github.com/llvm/llvm-project/commit/7292d051a94032ea9ea56471ad40cc81696cca5b
DIFF: https://github.com/llvm/llvm-project/commit/7292d051a94032ea9ea56471ad40cc81696cca5b.diff

LOG: [llvm-debuginfo-analyzer] Fix format string-type mismatch in LVScope

Fix mismatch between `%d`/`%x` format strings and `uint64_t` type.
This fixes incorrect printing of "Scope Sizes" on 32-bit platforms
where this leads to `llvm::print()` misreading vararg.

Fixes #58758

Differential Revision: https://reviews.llvm.org/D137400

Added: 
    

Modified: 
    llvm/lib/DebugInfo/LogicalView/Core/LVScope.cpp
    llvm/test/tools/llvm-debuginfo-analyzer/DWARF/06-dwarf-full-logical-view.test

Removed: 
    


################################################################################
diff  --git a/llvm/lib/DebugInfo/LogicalView/Core/LVScope.cpp b/llvm/lib/DebugInfo/LogicalView/Core/LVScope.cpp
index dd5530e07330a..f012bb471be2e 100644
--- a/llvm/lib/DebugInfo/LogicalView/Core/LVScope.cpp
+++ b/llvm/lib/DebugInfo/LogicalView/Core/LVScope.cpp
@@ -1192,7 +1192,8 @@ void LVScopeCompileUnit::addSize(LVScope *Scope, LVOffset Lower,
                                  LVOffset Upper) {
   LLVM_DEBUG({
     dbgs() << format(
-        "CU [0x%08x], Scope [0x%08x], Range [0x%08x:0x%08x], Size = %d\n",
+        "CU [0x%08" PRIx64 "], Scope [0x%08" PRIx64 "], Range [0x%08" PRIx64
+        ":0x%08" PRIx64 "], Size = %" PRId64 "\n",
         getOffset(), Scope->getOffset(), Lower, Upper, Upper - Lower);
   });
 
@@ -1548,7 +1549,7 @@ void LVScopeCompileUnit::printScopeSize(const LVScope *Scope, raw_ostream &OS) {
     // implementation-defined rounding inside printing functions.
     float Percentage =
         rint((float(Size) / CUContributionSize) * 100.0 * 100.0) / 100.0;
-    OS << format("%10d (%6.2f%%) : ", Size, Percentage);
+    OS << format("%10" PRId64 " (%6.2f%%) : ", Size, Percentage);
     Scope->print(OS);
 
     // Keep record of the total sizes at each lexical level.

diff  --git a/llvm/test/tools/llvm-debuginfo-analyzer/DWARF/06-dwarf-full-logical-view.test b/llvm/test/tools/llvm-debuginfo-analyzer/DWARF/06-dwarf-full-logical-view.test
index 742b2e0c3b11e..e83592afd2ffa 100644
--- a/llvm/test/tools/llvm-debuginfo-analyzer/DWARF/06-dwarf-full-logical-view.test
+++ b/llvm/test/tools/llvm-debuginfo-analyzer/DWARF/06-dwarf-full-logical-view.test
@@ -1,8 +1,5 @@
 ; REQUIRES: x86-registered-target
 
-; FIXME: Test failure https://reviews.llvm.org/D125783
-; UNSUPPORTED: arm
-
 ; Test case 6 - Full logical view
 
 ; test.cpp


        


More information about the llvm-commits mailing list