This is an archive of the discontinued LLVM Phabricator instance.

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

Authored by mgorny on Nov 4 2022, 1:24 AM.

Details

Summary

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.

Diff Detail

Event Timeline

mgorny created this revision.Nov 4 2022, 1:24 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 4 2022, 1:24 AM
mgorny requested review of this revision.Nov 4 2022, 1:24 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 4 2022, 1:24 AM
mgorny added a comment.Nov 4 2022, 1:27 AM

That said, I've only checked format strings in LVScope.cpp. I suspect other files may suffer from similar problems. If you replace llvm::format() with plain printf(), 32-bit GCC warns about type mismatches.

mgorny added a comment.Nov 4 2022, 1:27 AM

Sorry, I meant GCC building for a 32-bit target, not 32-bit GCC ;-).

That said, I've only checked format strings in LVScope.cpp. I suspect other files may suffer from similar problems. If you replace llvm::format() with plain printf(), 32-bit GCC warns about type mismatches.

PRIx64 it is a very good finding. I have the same feeling about the same issue in other modules. But at least we know the cause. Thanks for your fix.

This revision is now accepted and ready to land.Nov 4 2022, 4:11 AM

@mgorny Can you update and close https://github.com/llvm/llvm-project/issues/58758 after your fix is landed. Thanks.

mgorny added a comment.Nov 4 2022, 4:58 AM

@mgorny Can you update and close https://github.com/llvm/llvm-project/issues/58758 after your fix is landed. Thanks.

Will do. Thanks for the review!