Skip to content

[GSYM] Fix incorrect comparison in gSYM creation #131197

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 1 commit into from
Mar 14, 2025

Conversation

alx32
Copy link
Contributor

@alx32 alx32 commented Mar 13, 2025

There is a bug in llvm/lib/DebugInfo/GSYM/DwarfTransformer.cpp where StmtSeqVal was being compared against UINT32_MAX rather than the correct UINT64_MAX - thanks @nocchijiang for pointing this out.

We correct the issue with this patch. For testing - the issue would show when we have a correct offset of value UINT32_MAX - but constructing such a test is impractical.

@alx32 alx32 requested review from clayborg and kyulee-com March 13, 2025 19:39
@alx32 alx32 marked this pull request as ready for review March 13, 2025 19:41
@llvmbot
Copy link
Member

llvmbot commented Mar 13, 2025

@llvm/pr-subscribers-debuginfo

Author: None (alx32)

Changes

There is a bug in llvm/lib/DebugInfo/GSYM/DwarfTransformer.cpp where StmtSeqVal was being compared against UINT32_MAX rather than the correct UINT64_MAX - thanks @nocchijiang for pointing this out.

We correct the issue with this patch. For testing - the issue would show when we have a correct offset of value UINT32_MAX - but constructing such a test is impractical.


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

1 Files Affected:

  • (modified) llvm/lib/DebugInfo/GSYM/DwarfTransformer.cpp (+2-2)
diff --git a/llvm/lib/DebugInfo/GSYM/DwarfTransformer.cpp b/llvm/lib/DebugInfo/GSYM/DwarfTransformer.cpp
index ea989767d111c..290caa5f10782 100644
--- a/llvm/lib/DebugInfo/GSYM/DwarfTransformer.cpp
+++ b/llvm/lib/DebugInfo/GSYM/DwarfTransformer.cpp
@@ -324,8 +324,8 @@ static void convertFunctionLineTable(OutputAggregator &Out, CUInfo &CUI,
     // when it refers to an empty line sequence. In such cases, the DWARF linker
     // will exclude the empty sequence from the final output and assign
     // `UINT64_MAX` to the `DW_AT_LLVM_stmt_sequence` attribute.
-    auto StmtSeqVal = dwarf::toSectionOffset(StmtSeqAttr, UINT64_MAX);
-    if (StmtSeqVal != UINT32_MAX)
+    uint64_t StmtSeqVal = dwarf::toSectionOffset(StmtSeqAttr, UINT64_MAX);
+    if (StmtSeqVal != UINT64_MAX)
       StmtSeqOffset = StmtSeqVal;
   }
 

@alx32 alx32 requested a review from DataCorrupted March 14, 2025 01:26
@alx32 alx32 merged commit 8c31bb7 into llvm:main Mar 14, 2025
13 of 15 checks passed
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