Sonar complains that given `current_red == nullptr` check, it is plausible `current_red->print();` would dereference the null pointer. Also `first_red` seems to be unused.
VTransformReductionVectorNode* first_red = this;
VTransformReductionVectorNode* last_red = phi->in_req(2)->isa_ReductionVector();
VTransformReductionVectorNode* current_red = last_red;
while (true) {
if (current_red == nullptr ||
current_red->vector_reduction_opcode() != ropc ||
current_red->element_basic_type() != bt ||
current_red->vector_length() != vlen) {
TRACE_OPTIMIZE(
tty->print(" Cannot move out of loop, other reduction node does not match:");
print();
tty->print(" other: ");
current_red->print();
)
return false; // not compatible
}