RFR: 8312596: Potential null pointer access in Compile::TracePhase::~TracePhase after JDK-8311976

Christian Hagedorn chagedorn at openjdk.org
Tue Jul 25 10:26:44 UTC 2023


On Mon, 24 Jul 2023 18:16:19 GMT, Ashutosh Mehra <duke at openjdk.org> wrote:

> Please review this PR to fix a potential null pointer access in using `_compile`.
> Updated the code to unconditionally initialize `_compile` and added an assert (similar to C1's `PhaseTraceTime` constructor) for it to be non-null.

I suggest to remove the word "potential" in the bug title because we can trigger the null pointer with

java -XX:+PrintIdealNodeCount --version

Maybe you also want to add a Hello World like sanity test with `-XX:+PrintIdealNodeCount`.

Otherwise, the fix looks good.

src/hotspot/share/opto/compile.cpp line 4340:

> 4338:     _dolog(CITimeVerbose)
> 4339: {
> 4340:   assert(_compile != nullptr, "sanity check");

I don't think this is ever null but I guess it does not hurt to keep it in.

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

PR Review: https://git.openjdk.org/jdk/pull/15002#pullrequestreview-1545118482
PR Review Comment: https://git.openjdk.org/jdk/pull/15002#discussion_r1273319688


More information about the hotspot-compiler-dev mailing list