RFR: JDK-8300823: UB: Compile::_phase_optimize_finished is initialized too late
Damon Fenacci
duke at openjdk.org
Thu Jan 26 07:10:57 UTC 2023
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.
-------------
Commit messages:
- JDK-8300823: update copyright year
- JDK-8300823: UB: Compile::_phase_optimize_finished is initialized too late
Changes: https://git.openjdk.org/jdk/pull/12192/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=12192&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8300823
Stats: 13 lines in 1 file changed: 6 ins; 6 del; 1 mod
Patch: https://git.openjdk.org/jdk/pull/12192.diff
Fetch: git fetch https://git.openjdk.org/jdk pull/12192/head:pull/12192
PR: https://git.openjdk.org/jdk/pull/12192
More information about the hotspot-compiler-dev
mailing list