RFR: 8314114: Fix -Wconversion warnings in os code, primarily linux [v4]

Dean Long dlong at openjdk.org
Fri Aug 11 19:53:58 UTC 2023


On Fri, 11 Aug 2023 12:00:22 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

>> Yes, exactly, and we have hit similar bugs before.  But the bug seems harmless here.
>
> So, comment?  What should it say?

I think it makes sense to have something like checked_cast here, maybe call it double_to_int(), that checks against INT_MIN and INT_MAX.  Also, using double instead of float removes the round-up problem as long as the input is <= 32 bits.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/15229#discussion_r1291723348


More information about the hotspot-dev mailing list