RFR: 8371762: Incorrect use of checked_cast in Arguments::process_settings_file [v4]

Axel Boldt-Christmas aboldtch at openjdk.org
Mon Jan 12 13:28:36 UTC 2026


On Fri, 2 Jan 2026 19:54:26 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:

>> Axel Boldt-Christmas has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains four additional commits since the last revision:
>> 
>>  - Merge tag 'jdk-27+3' into JDK-8371762
>>    
>>    Added tag jdk-27+3 for changeset 4f283f18
>>  - Merge tag 'jdk-26+26' into JDK-8371762
>>    
>>    Added tag jdk-26+26 for changeset 847fbab7
>>  - Update src/hotspot/share/runtime/arguments.cpp
>>    
>>    Co-authored-by: David Holmes <62092539+dholmes-ora at users.noreply.github.com>
>>  - 8371762: Incorrect use of checked_cast in Arguments::process_settings_file
>
> src/hotspot/share/runtime/arguments.cpp line 1225:
> 
>> 1223:     // below (which would be incorrect if we ever compared to a non-ascii char),
>> 1224:     // and the int to char conversions we would otherwise do in the assignments.
>> 1225:     const char c = checked_cast<char>(checked_cast<unsigned char>(c_or_eof));
> 
> Why is this using `checked_cast` at all?  Just assume `getc` correctly
> implements its documented behavior, and use `static_cast<char>(c_or_eof)` to
> silence (hopefully eventual) `-Wconversion` warnings.

Seems reasonable to assume `getc` follows its documented behaviour. Changed to `static_cast`.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/28283#discussion_r2682270777


More information about the hotspot-runtime-dev mailing list