[PATCH] D58451: [DebugInfo] Fix the type of the formated variable

Miloš Stojanović via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 21 05:52:23 PST 2019


mstojanovic added inline comments.


================
Comment at: lib/DebugInfo/DWARF/DWARFDebugFrame.cpp:303
   if (Personality)
-    OS << format("  Personality Address: %08x\n", *Personality);
+    OS << format("  Personality Address: %08" PRIx64 "\n", *Personality);
   if (!AugmentationData.empty()) {
----------------
probinson wrote:
> Well, that looks like an improvement, but if the address is 64-bit, won't this print only the low-order half?
This doesn't truncate so it **would** print the whole address but it's true that if the address can be 64-bit the output should be padded with the appropriate number of zeroes to indicate that.
I didn't change this because I assumed that the previous code was correct in guarantying a 32-bit output. Printing only 32 bits of a 64 bit variable isn't unique to this code and can be seen in other pars of LLVM as well, which leads me to believe that variables being 64-bit doesn't necessarily mean that there is a possibility they could hold a 64-bit value while being printed.
@rafauler Do you know if these addresses could be 64-bit here?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D58451/new/

https://reviews.llvm.org/D58451





More information about the llvm-commits mailing list