RFR: 8346914: UB issue in scalbnA

Kim Barrett kbarrett at openjdk.org
Tue Jun 10 03:49:34 UTC 2025


On Mon, 9 Jun 2025 13:20:16 GMT, Axel Boldt-Christmas <aboldtch at openjdk.org> wrote:

> Might it is the case that casting the number here is also UB

The casting is implementation-defined until C++20, and all supported platforms define it as the "obvious"
two's-complement conversion.

`INT_MAX` is equivalent to, but less wordy than using `std::numeric_limits<int>::max()`. But this
doesn't matter with my suggested change to limit the scope of use of `u_k`.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/25656#discussion_r2136813714


More information about the hotspot-dev mailing list