RFR: JDK-8300823: UB: Compile::_phase_optimize_finished is initialized too late
Tobias Hartmann
thartmann at openjdk.org
Thu Jan 26 07:10:58 UTC 2023
On Wed, 25 Jan 2023 12:17:52 GMT, Damon Fenacci <duke at openjdk.org> wrote:
> Clang _Undefined Behaviour Sanitizer_ has pointed out a spurious load of the `bool` field `Compile::_phase_optimize_finished` with non-boolean values.
>
> This is due to `Compile::_phase_optimize_finished` being initialized too late in the `Compile::Init` method (e.g. https://github.com/openjdk/jdk/blob/544c16e0bdd4335b2624158fd1f6521984aa5079/src/hotspot/share/opto/compile.cpp#L983 indirectly invokes `Compile::phase_optimize_finished()` to read the field).
>
> So, moving the `_phase_optimize_finished` initialization (and the initialization of the other 2 fields in the same `ASSERT` block) up in the `Compile::Init` method.
Looks good to me.
-------------
Marked as reviewed by thartmann (Reviewer).
PR: https://git.openjdk.org/jdk/pull/12192
More information about the hotspot-compiler-dev
mailing list