RFR: 8313882: Fix -Wconversion warnings in runtime code [v6]
Patricio Chilano Mateo
pchilanomate at openjdk.org
Wed Aug 9 19:52:58 UTC 2023
On Wed, 9 Aug 2023 15:43:28 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:
>> Here are fixes to silence -Wconversion warnings in runtime code. Use direct cast for 64 bit int to double, otherwise default to checked_cast<>. I changed the declaration of _held_monitor_count and _jni_monitor count to intx to fix cascade of warnings coming from this.
>>
>> src/hotspot/share/runtime/synchronizer.cpp:1802:41: warning: conversion from 'intx' {aka 'long int'} to 'int' may change value [-Wconversion]
>> 1802 | _thread->dec_held_monitor_count(rec + 1);
>> | ~~~~^~~
>>
>> Tested with tier1-4 on linux-x64-debug and windows-x64-debug and tier1 on Oracle supported platforms.
>
> Coleen Phillimore has updated the pull request incrementally with two additional commits since the last revision:
>
> - put checked_cast around getc().
> - put checked_cast around getc().
Thanks for the fixes. Looks good to me.
src/hotspot/share/runtime/arguments.cpp line 1184:
> 1182:
> 1183: char c = checked_cast<char>(getc(stream));
> 1184: while(c != EOF && pos < (int)(sizeof(token)-1)) {
I see error in some builds due to the EOF comparison though now that c is a char.
-------------
Marked as reviewed by pchilanomate (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/15177#pullrequestreview-1570400279
PR Review Comment: https://git.openjdk.org/jdk/pull/15177#discussion_r1289118732
More information about the hotspot-dev
mailing list