RFR: 8314265: Fix -Wconversion warnings in miscellaneous runtime code [v4]

Coleen Phillimore coleenp at openjdk.org
Thu Aug 17 00:10:28 UTC 2023


On Wed, 16 Aug 2023 23:43:36 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

>> uint64_t operation_advance;
>>       if (!_reader.read_uleb128(&operation_advance, 4)) {
>>         // Must be at most 4 bytes because the index register is only 4 bytes wide.
>>         return false;
>>       }
>>       _state->add_to_address_register(operation_advance, _header);
>> 
>> This is why I changed it.  Should operation_advance be static_cast<uint8_t> here ? This read function reads 64 bits of info.
>
> src/hotspot/share/utilities/elfFile.cpp:1723:47: warning: conversion from 'int' to 'uint8_t' {aka 'u
> nsigned char'} may change value [-Wconversion]
>  1723 |   _op_index = (_op_index + operation_advance) % header._maximum_operations_per_instruction;
>       |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Changing op_index back fixes the warnings.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/15233#discussion_r1296538634


More information about the build-dev mailing list