Skip to content

__(U)INTPTR_WIDTH__ and __POINTER_WIDTH__ macros are too wide #795

@brooksdavis

Description

@brooksdavis

On 64-bit targets these are currently:

#define __INTPTR_WIDTH__ 128
#define __UINTPTR_WIDTH__ 128
#define __POINTER_WIDTH__ 128

C23 § 5.2.5.3.2 states:

For all signed integer types for which <limits.h> or <stdint.h> define a macro with suffix _WIDTH holding its width N , there are macros with suffix _MIN and _MAX holding the minimal and maximal values −2^(N−1) and 2^(N−1) − 1 that are representable by the type and that have the same type as would an expression that is an object of the corresponding type converted according to the integer promotions.

Which I think makes it clear that on 64-bit CHERI these should all be 64. (As further evidence of a lack of correspondence with sizeof, BOOL_WIDTH is defined to be exactly 1 at the top of the section).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions