From f6947173d449f7ed1f7968eca905da44a1359e35 Mon Sep 17 00:00:00 2001 From: Vishal Chand Date: Fri, 14 Nov 2025 13:00:27 +0000 Subject: [PATCH 1/2] 8371881: C2: Fix potential SEGV in VTransformReductionVectorNode tracing --- src/hotspot/share/opto/vtransform.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/hotspot/share/opto/vtransform.cpp b/src/hotspot/share/opto/vtransform.cpp index e775eb60cab7e..f0e5569aaf499 100644 --- a/src/hotspot/share/opto/vtransform.cpp +++ b/src/hotspot/share/opto/vtransform.cpp @@ -1252,7 +1252,6 @@ bool VTransformReductionVectorNode::optimize_move_non_strict_order_reductions_ou // back to the phi. Check that all non strict order reductions only have a single // use, except for the last (last_red), which only has phi as a use in the loop, // and all other uses are outside the loop. - VTransformReductionVectorNode* first_red = this; VTransformReductionVectorNode* last_red = phi->in_req(2)->isa_ReductionVector(); VTransformReductionVectorNode* current_red = last_red; while (true) { @@ -1264,7 +1263,11 @@ bool VTransformReductionVectorNode::optimize_move_non_strict_order_reductions_ou tty->print(" Cannot move out of loop, other reduction node does not match:"); print(); tty->print(" other: "); - current_red->print(); + if (current_red != nullptr) { + current_red->print(); + } else { + tty->print(" nullptr"); + } ) return false; // not compatible } From 0824593d2a6f4f4ec2ad5f42d303428962866a5a Mon Sep 17 00:00:00 2001 From: Vishal Chand Date: Fri, 14 Nov 2025 15:54:08 +0000 Subject: [PATCH 2/2] Update src/hotspot/share/opto/vtransform.cpp MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Aleksey Shipilëv --- src/hotspot/share/opto/vtransform.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hotspot/share/opto/vtransform.cpp b/src/hotspot/share/opto/vtransform.cpp index f0e5569aaf499..b437d2e6eaccb 100644 --- a/src/hotspot/share/opto/vtransform.cpp +++ b/src/hotspot/share/opto/vtransform.cpp @@ -1266,7 +1266,7 @@ bool VTransformReductionVectorNode::optimize_move_non_strict_order_reductions_ou if (current_red != nullptr) { current_red->print(); } else { - tty->print(" nullptr"); + tty->print("nullptr"); } ) return false; // not compatible