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

Coleen Phillimore coleenp at openjdk.org
Wed Aug 16 23:46:36 UTC 2023


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

>> So put the cast here?
>
> 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;
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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

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


More information about the build-dev mailing list