RFR: 8310921: Fix -Wconversion warnings from GenerateOopMap [v2]

Coleen Phillimore coleenp at openjdk.org
Wed Jun 28 00:27:03 UTC 2023


On Tue, 27 Jun 2023 23:31:30 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> Coleen Phillimore has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   David Holmes comments
>
> src/hotspot/share/oops/generateOopMap.cpp line 2060:
> 
>> 2058:   tty->print_cr ("  Total : %3.3f sec.", GenerateOopMap::_total_oopmap_time.seconds());
>> 2059:   tty->print_cr ("  (%3.0f bytecodes per sec) ",
>> 2060:   (double)GenerateOopMap::_total_byte_count / GenerateOopMap::_total_oopmap_time.seconds());
> 
> I still don't see a need for the double cast here - the normal numeric promotion rules will make the expression a double. What error is reported for this code?

/hotspot/share/oops/generateOopMap.cpp: In static member function 'static void GenerateOopMap::print_time()':
/hotspot/share/oops/generateOopMap.cpp:2060:19: warning: conversion from 'uint64_t' {aka 'long unsigned int'} to 'double' may change value [-W
conversion]
 2060 |   GenerateOopMap::_total_byte_count / GenerateOopMap::_total_oopmap_time.seconds());
      |   ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~

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

PR Review Comment: https://git.openjdk.org/jdk/pull/14666#discussion_r1244513383


More information about the hotspot-dev mailing list