RFR: 8371881: C2: Fix potential SEGV in VTransformReductionVectorNode tracing

Aleksey Shipilev shade at openjdk.org
Fri Nov 14 15:33:45 UTC 2025


On Fri, 14 Nov 2025 13:24:14 GMT, Vishal Chand <duke at openjdk.org> wrote:

> This PR fixes a potential SEGV and removes dead code:
> • **Fix**: Prevent potential SEGV in VTransformReductionVectorNode - [from @shipilev] This fixes a crash in diagnostic code when isa_ReductionVector() unexpectedly returns nullptr. While this indicates the graph is already corrupted, the additional crash in `TRACE_OPTIMIZE` makes debugging harder. The fix adds defensive null checking to prevent the diagnostic crash and improve error handling.
> 
> • **Cleanup**: Remove unused first_red variable

Looks fine, but @eme64 should take a look as well.

src/hotspot/share/opto/vtransform.cpp line 1269:

> 1267:           current_red->print();
> 1268:         } else {
> 1269:           tty->print(" nullptr");

Suggestion:

          tty->print("nullptr");

-------------

Marked as reviewed by shade (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/28323#pullrequestreview-3465474733
PR Review Comment: https://git.openjdk.org/jdk/pull/28323#discussion_r2527913198


More information about the hotspot-compiler-dev mailing list