RFR: JDK-8300823: UB: Compile::_phase_optimize_finished is initialized too late

Damon Fenacci duke at openjdk.org
Fri Jan 27 09:51:16 UTC 2023


On Wed, 25 Jan 2023 19:14:59 GMT, Tobias Hartmann <thartmann 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.

@TobiHartmann @chhagedorn thanks a lot for your reviews!

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

PR: https://git.openjdk.org/jdk/pull/12192


More information about the hotspot-compiler-dev mailing list