Skip to content

ACLE and UBSan disagree about clz with input zero #63113

@tmatheson-arm

Description

@tmatheson-arm

D152023 made calls to __builtin_clz and __builtin_ctz with input 0 to be undefined behaviour (RFC here). However we use them in the arm-acle.h to implement __clz:

return (uint32_t)__builtin_clz(__t);

The ACLE documentation for __clz states:

When x is zero it returns the argument width, i.e. 32 or 64.

The definitions in the header will need to be updated to handle the zero case.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions