JDK-8309295 : C2: MaxNode::signed_min() returns nullptr for int operands
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 17,21
  • Priority: P5
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2023-06-01
  • Updated: 2023-06-09
  • Resolved: 2023-06-02
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 21
21 b26Fixed
Related Reports
Blocks :  
Relates :  
Description
MaxNode::signed_min() always returns nullptr, instead of the expected MinI node, when the type of a and b is int. This is caused by an accidental redefinition of 'res' in the MaxNode::build_min_max() function that implements MaxNode::signed_min():

Node* MaxNode::build_min_max(Node* a, Node* b, bool is_max, bool is_unsigned, ...) {
  bool is_int = gvn.type(a)->isa_int();
  (...)
  Node* res = nullptr;
  if (is_int && !is_unsigned) {
    if (is_max) {
      (...)
    } else {
      Node* res =  gvn.transform(new MinINode(a, b));
      (...)
    }
  } else {
    (...)
  }
  (...)
  return res;
}

The bug has not surfaced yet because the code is unreachable: the only current calls to MaxNode::signed_min() (from PhaseIdealLoop::clamp() and PhaseMacroExpand::expand_macro_nodes()) are for long arguments.
Comments
Changeset: 60f3b87d Author: Roberto CastaƱeda Lozano <rcastanedalo@openjdk.org> Date: 2023-06-02 06:34:15 +0000 URL: https://git.openjdk.org/jdk/commit/60f3b87d96bcb827a217ea74a53bbcb9c0a51892
02-06-2023

Code was introduced by JDK-8244504. ILW = P5 because it's not an issue in current code.
02-06-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/14272 Date: 2023-06-01 19:18:04 +0000
02-06-2023