Skip to content

clang arbitrary-width integer types don't calculate size/alignment correctly #3940

@efriedma-quic

Description

@efriedma-quic
Bugzilla Link 3568
Resolution WONTFIX
Resolved on Aug 08, 2010 01:46
Version unspecified
OS Linux

Extended Description

I added support for arbitrary-width integer types in r64434. The one known bug in the implementation is that Sema doesn't calculate the size/alignment consistently with LLVM. (And for 128-bit integers, it calculates the alignment to be 128 bits, which as far as I know is not consistent with gcc's TImode.)

LLVM logic for determining the size/alignment:
If there is at least one known integer type whose bitwidth is equal to or larger than the bitwidth of the given integer type, the alignment is that of the smallest such type. Otherwise, the alignment is the alignment of the largest known integer type. The size is then the bitwidth plus whatever padding is necessary to satisfy the alignment.

What makes this non-trivial is that TargetInfo doesn't expose a list of integer types outside of the target description string, and it's definitely too much work to parse the target description.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillaclang:frontendLanguage frontend issues, e.g. anything involving "Sema"wontfixIssue is real, but we can't or won't fix it. Not invalid

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions