diff options
| author | Chris Lattner <sabre@nondot.org> | 2002-08-02 23:08:32 +0000 | 
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2002-08-02 23:08:32 +0000 | 
| commit | 33b3b9660b787441bdcd0de87e1e2d4902fe1e56 (patch) | |
| tree | 06db9a8ea06da245c79458a0839829906c27aee8 | |
| parent | 600ba8fa6dea25cb13f588f2604b87f26c851508 (diff) | |
| download | bcm5719-llvm-33b3b9660b787441bdcd0de87e1e2d4902fe1e56.tar.gz bcm5719-llvm-33b3b9660b787441bdcd0de87e1e2d4902fe1e56.zip | |
Fix problem where lli would not print out a 64 bit value when the client code
uses the modifier "%ld".  Now lli passes off "%lld" to the underlying runtime
library in this case.
llvm-svn: 3230
| -rw-r--r-- | llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp | 12 | 
1 files changed, 10 insertions, 2 deletions
| diff --git a/llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp b/llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp index 6d1354c42b1..1a425c2bb62 100644 --- a/llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp +++ b/llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp @@ -351,9 +351,17 @@ GenericValue lle_X_sprintf(FunctionType *M, const vector<GenericValue> &Args) {        case 'd': case 'i':        case 'u': case 'o':        case 'x': case 'X': -        if (HowLong == 2) +        if (HowLong >= 1) { +          if (HowLong == 1) { +            // Make sure we use %lld with a 64 bit argument because we might be +            // compiling LLI on a 32 bit compiler. +            unsigned Size = strlen(FmtBuf); +            FmtBuf[Size] = FmtBuf[Size-1]; +            FmtBuf[Size+1] = 0; +            FmtBuf[Size-1] = 'l'; +          }            sprintf(Buffer, FmtBuf, Args[ArgNo++].ULongVal); -        else +        } else            sprintf(Buffer, FmtBuf, Args[ArgNo++].IntVal); break;        case 'e': case 'E': case 'g': case 'G': case 'f':          sprintf(Buffer, FmtBuf, Args[ArgNo++].DoubleVal); break; | 

