[LLVMbugs] [Bug 4040] New: APInt's string constructor is too strict

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Wed Apr 22 23:53:35 PDT 2009


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

           Summary: APInt's string constructor is too strict
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Support Libraries
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: jyasskin at google.com
                CC: llvmbugs at cs.uiuc.edu


Created an attachment (id=2859)
 --> (http://llvm.org/bugs/attachment.cgi?id=2859)
Overly-simple test and fix

Calls like APInt(1, "1", 1, 10) fail the assert that ((slen*64)/22 <= numbits.
I ran into this in code that llc -march=cpp emits.

I've attached a patch with a test for this kind of case and the simplest fix
that could possibly work. I just subtract one from slen before checking if it's
too big for the number of bits. You probably actually want better a test and
fix, but this should capture the idea.


-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list