[libc-commits] [libc] [libc][stdfix] Guard DiviFxTest shift edge cases against narrow IntType (PR #209970)

via libc-commits libc-commits at lists.llvm.org
Wed Jul 15 23:20:48 PDT 2026


sohail103 wrote:

> Did you consider or test computing this via an unsigned intermediate instead of skipping, so the check still runs on ILP32?

On riscv32 ilp32, INTEGRAL_LEN is 32 and long int is also 32 bits wide. 1<<32 would be UB regardless of signedness. Switching to unsigned wouldn't fix the build error there. epsilon_result's issue is that we could technically work around it with an unsigned intermediate but the expected value (2^31) doesn't fit in long int on ILP32 so there's no valid value to check against regardless of how its computed.

> https://godbolt.org/z/v9o847jan

I think INTEGRAL_LEN should be 32 to reproduce this issue.

https://github.com/llvm/llvm-project/pull/209970


More information about the libc-commits mailing list