Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8309295

C2: MaxNode::signed_min() returns nullptr for int operands

XMLWordPrintable

    • b26

      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.

            rcastanedalo Roberto Castaneda Lozano
            rcastanedalo Roberto Castaneda Lozano
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: