Skip to content

APInt's string constructor is too strict #4412

@llvmbot

Description

@llvmbot
Bugzilla Link 4040
Resolution FIXED
Resolved on Apr 25, 2009 13:34
Version trunk
OS All
Attachments Overly-simple test and fix
Reporter LLVM Bugzilla Contributor

Extended Description

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzilla

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions