JDK-8313249 : Fix -Wconversion warnings in verifier code
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 22
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2023-07-27
  • Updated: 2023-08-10
  • Resolved: 2023-08-01
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 22
22 b09Fixed
Related Reports
Relates :  
Description
In my warnings count:

55 /src/hotspot/share/classfile/verifier.cpp
29 /src/hotspot/share/classfile/stackMapFrame.cpp
18 /src/hotspot/share/classfile/stackMapTableFormat.hpp
15 /src/hotspot/share/classfile/stackMapFrame.hpp
10 /src/hotspot/share/classfile/stackMapTable.cpp

The verifiers functions take u2 for bci and index but then use these as int to print out any verification errors or keep in the stack allocated container types for error reporting.   It also has a comment to use int32_t for various counts on purpose, so passing u2 to these counts doesn't make sense.

  // Logically, the _frame_count (as well as many fields in the StackFrame)
  // should be a u2, but if we defined the variable as that type it will
  // be difficult to detect/recover from overflow or underflow conditions.
  // Widening the type and making it signed will help detect these.
  int32_t              _code_length;
  int32_t              _frame_count;     // Stackmap frame count

Comments
Changeset: ee3e0917 Author: Coleen Phillimore <coleenp@openjdk.org> Date: 2023-08-01 11:59:11 +0000 URL: https://git.openjdk.org/jdk/commit/ee3e0917b393b879a543060ace2537be84f20e82
01-08-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/15056 Date: 2023-07-27 15:51:01 +0000
27-07-2023