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

David Holmes dholmes at openjdk.org
Wed Jun 28 01:00:06 UTC 2023


On Wed, 28 Jun 2023 00:23:53 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

>> 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());
>       |   ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~

Ah now I see. Thanks.

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

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


More information about the hotspot-dev mailing list