Skip to content

Resolve implicit trunc TODOs #112510

Open
Open
@nikic

Description

@nikic

#106524 introduces a consistency assertion in the APInt constructor (currently still disabled by default), which verifies that the passed value is indeed a signed/unsigned value of the indicated bit width.

To allow this assertion to be enabled by default, a number of // TODO: Avoid implicit trunc? comments were left behind, in cases where it was not immediately clear whether/how the implicit truncation in the APInt constructor could be avoided.

Long term, these should be resolved in one three ways:

  • Determine that the implicit truncation is actually desirable/acceptable in the given context. Replace the TODO with a comment explaining why.
  • Change the code to avoid passing values that require implicit truncation.
  • Make an API change, e.g. by propagating the implicitTrunc parameter up, so that some users can use it and some not. Or by accepting an APInt instead of a plain integer and leaving the proper construction to callers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions