[LLVMbugs] [Bug 20715] New: llvm::format() prints incorrect values for %ul

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Aug 20 15:28:46 PDT 2014


http://llvm.org/bugs/show_bug.cgi?id=20715

            Bug ID: 20715
           Summary: llvm::format() prints incorrect values for %ul
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Support Libraries
          Assignee: unassignedbugs at nondot.org
          Reporter: jeremysalwen at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Example code:

StringRef lol="hi";
dbgs()<< format("%s %lu",lol, 1)<<"\n";

Expected Output:
hi 1

Actual Output:
hi 2

In general the number printed out will be some arbitrary number around the
range of 0-40 rather than the actual value of the argument given.

The bug is not present with format strings %d and %u, but still is present with
%llu.  If the %s is not present before the %ul, I wasn't able to reproduce the
bug, but  I didn't try very hard.  

Luckily in my use case it was obvious that the values printed were wrong, but
this could potentially cause tools using format() to give extremely misleading
output.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140820/f74be29a/attachment.html>


More information about the llvm-bugs mailing list