Skip to contentSkip to conversation

libvixl: Fix format strings for several int64_t values

PATCH In review Stefan Weil 3 participants 5 messages Mar 7, 2014 – Mar 10, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libvixl: Fix format strings for several int64_t values

"%d" or "%x" won't work on hosts where int values are smaller than 64 bit.

---
 disas/libvixl/a64/disasm-a64.cc |   20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
disas/libvixl/a64/disasm-a64.cc +10 -10
index 5c6b898..5f172da 100644
@@ -1342,7 +1342,7 @@ int Disassembler::SubstituteImmediateField(Instruction* instr,
         ASSERT(format[5] == 'L');
         AppendToOutput("#0x%" PRIx64, instr->ImmMoveWide());
         if (instr->ShiftMoveWide() > 0) {
-          AppendToOutput(", lsl #%d", 16 * instr->ShiftMoveWide());
+          AppendToOutput(", lsl #%" PRId64, 16 * instr->ShiftMoveWide());
         }
       }
       return 8;
@@ -1391,7 +1391,7 @@ int Disassembler::SubstituteImmediateField(Instruction* instr,
     }
     case 'F': {  // IFPSingle, IFPDouble or IFPFBits.
       if (format[3] == 'F') {  // IFPFbits.
-        AppendToOutput("#%d", 64 - instr->FPScale());
+        AppendToOutput("#%" PRId64, 64 - instr->FPScale());
         return 8;
       } else {
         AppendToOutput("#0x%" PRIx64 " (%.4f)", instr->ImmFP(),
@@ -1412,23 +1412,23 @@ int Disassembler::SubstituteImmediateField(Instruction* instr,
       return 5;
     }
     case 'P': {  // IP - Conditional compare.
-      AppendToOutput("#%d", instr->ImmCondCmp());
+      AppendToOutput("#%" PRId64, instr->ImmCondCmp());
       return 2;
     }
     case 'B': {  // Bitfields.
       return SubstituteBitfieldImmediateField(instr, format);
     }
     case 'E': {  // IExtract.
-      AppendToOutput("#%d", instr->ImmS());
+      AppendToOutput("#%" PRId64, instr->ImmS());
       return 8;
     }
     case 'S': {  // IS - Test and branch bit.
-      AppendToOutput("#%d", (instr->ImmTestBranchBit5() << 5) |
-                            instr->ImmTestBranchBit40());
+      AppendToOutput("#%" PRId64, (instr->ImmTestBranchBit5() << 5) |
+                                  instr->ImmTestBranchBit40());
       return 2;
     }
     case 'D': {  // IDebug - HLT and BRK instructions.
-      AppendToOutput("#0x%x", instr->ImmException());
+      AppendToOutput("#0x%" PRIx64, instr->ImmException());
       return 6;
     }
     default: {
@@ -1598,12 +1598,12 @@ int Disassembler::SubstituteExtendField(Instruction* instr,
       (((instr->ExtendMode() == UXTW) && (instr->SixtyFourBits() == 0)) ||
        (instr->ExtendMode() == UXTX))) {
     if (instr->ImmExtendShift() > 0) {
-      AppendToOutput(", lsl #%d", instr->ImmExtendShift());
+      AppendToOutput(", lsl #%" PRId64, instr->ImmExtendShift());
     }
   } else {
     AppendToOutput(", %s", extend_mode[instr->ExtendMode()]);
     if (instr->ImmExtendShift() > 0) {
-      AppendToOutput(" #%d", instr->ImmExtendShift());
+      AppendToOutput(" #%" PRId64, instr->ImmExtendShift());
     }
   }
   return 3;
@@ -1632,7 +1632,7 @@ int Disassembler::SubstituteLSRegOffsetField(Instruction* instr,
   if (!((ext == UXTX) && (shift == 0))) {
     AppendToOutput(", %s", extend_mode[ext]);
     if (shift != 0) {
-      AppendToOutput(" #%d", instr->SizeLS());
+      AppendToOutput(" #%" PRId64, instr->SizeLS());
     }
   }
   return 9;
Signature · 1 line
1.7.9.5
#1 lore raw

Am 07.03.2014 20:15, schrieb Stefan Weil:

Quoted 6 lines

"%d" or "%x" won't work on hosts where int values are smaller than 64 bit.

---
 disas/libvixl/a64/disasm-a64.cc |   20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

Patch looks correct, but I see no indication that this is a backport from upstream libvixl. Have you submitted it there too?

Regards,
Andreas

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#2 lore raw

Am 07.03.2014 20:42, schrieb Andreas Färber:

Quoted 8 lines

Am 07.03.2014 20:15, schrieb Stefan Weil:

Quoted 6 lines

"%d" or "%x" won't work on hosts where int values are smaller than 64 bit.

---
 disas/libvixl/a64/disasm-a64.cc |   20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
Quoted 5 lines

Patch looks correct, but I see no indication that this is a backport from upstream libvixl. Have you submitted it there too?

Regards,
Andreas

If I knew how to submit it to libvixl, I'd have done that already. I did not find any hint (e-mail address, keyword contrib) in the sources from github. Can you help me? It would also be fine if someone just takes my patch and applies it there.

Thanks,
Stefan

#3 lore raw

Am 07.03.2014 21:01, schrieb Stefan Weil:

Quoted 9 lines

Am 07.03.2014 20:42, schrieb Andreas Färber:

Quoted 8 lines

Am 07.03.2014 20:15, schrieb Stefan Weil:

Quoted 6 lines

"%d" or "%x" won't work on hosts where int values are smaller than 64 bit.

---
 disas/libvixl/a64/disasm-a64.cc |   20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
Quoted 6 lines
Quoted 2 lines

Patch looks correct, but I see no indication that this is a backport from upstream libvixl. Have you submitted it there too?

If I knew how to submit it to libvixl, I'd have done that already. I did not find any hint (e-mail address, keyword contrib) in the sources from github. Can you help me?

Google led me to the following:
https://github.com/armvixl/vixl

[email protected]

Quoted 2 lines

It would also be fine if someone just takes my
patch and applies it there.

Hopefully Peter can help; I just remembered someone asking not to apply spelling fixes to not complicate functional backports.

Cheers,
Andreas

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#4 lore raw
Quoted 13 lines · Andreas Färber

Am 07.03.2014 21:01, schrieb Stefan Weil:

Quoted 12 lines

Am 07.03.2014 20:42, schrieb Andreas Färber:

Quoted 10 lines

Am 07.03.2014 20:15, schrieb Stefan Weil:

Quoted 6 lines

"%d" or "%x" won't work on hosts where int values are smaller than 64 bit.

---
 disas/libvixl/a64/disasm-a64.cc |   20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

Patch looks correct, but I see no indication that this is a backport from upstream libvixl. Have you submitted it there too?

Quoted 8 lines
Quoted 3 lines

If I knew how to submit it to libvixl, I'd have done that already. I did not find any hint (e-mail address, keyword contrib) in the sources from github. Can you help me?

Google led me to the following:
https://github.com/armvixl/vixl

[email protected]

This is the right email address and git repo, yes. (our disas/libvixl/README gives the github URL, at least.)

I would encourage you to email them patches, it will act as a prod for them to get themselves set up to handle incoming contributions properly :-)

Quoted 5 lines
Quoted 2 lines

It would also be fine if someone just takes my
patch and applies it there.

Hopefully Peter can help; I just remembered someone asking not to apply spelling fixes to not complicate functional backports.

I will apply this patch to target-arm.next. I'm happy that we carry genuine bugfixes to libvixl (hopefully in anticipation of them going away on a future update), it's only non-functional changes I'd rather we don't carry in our tree.

thanks
-- PMM