RFR: 8313249: Fix -Wconversion warnings in verifier code
Coleen Phillimore
coleenp at openjdk.org
Fri Jul 28 21:30:41 UTC 2023
On Fri, 28 Jul 2023 19:10:48 GMT, Ioi Lam <iklam at openjdk.org> wrote:
>> See bugid for comments. Most of the verifier code deals with ints, so the u2 and other parameters weren't really needed and can be promoted to int. Mostly types are changed, but a few checked_cast<>s are added.
>> Tested with tier1-4, sanity Oracle platforms.
>
> src/hotspot/share/classfile/stackMapTableFormat.hpp line 481:
>
>> 479:
>> 480: static u1 chops_to_frame_type(int chop) {
>> 481: return (u1)(251 - chop);
>
> This looks dangerous. If the range is alway within `u1`, it should use `checked_cast<u1>`, and you should also assert `chop <= 251`.
I agree, this one I should have used checked_cast<u1>.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/15056#discussion_r1278097762
More information about the hotspot-runtime-dev
mailing list