Integrated: 8305672: Surprising definite assignment error after JDK-8043179
Archie Cobbs
acobbs at openjdk.org
Mon May 1 13:39:53 UTC 2023
On Wed, 5 Apr 2023 22:42:58 GMT, Archie Cobbs <acobbs at openjdk.org> wrote:
> The fix for [JDK-8043179](https://bugs.openjdk.org/browse/JDK-8043179) is to clear the DU flags for all variables when entering a lamba. This reflects the fact that the lamba's actual execution could be arbitrarily far in the future, so we can't assume anything that is DU when the lambda is created is still DU when the lambda actually executes.
>
> However, this fix created a new bug. The problem is that `visitLambda()` does not save & restore the `uninitsTry` bits, which are used by `visitTry()` to track DU variables within `try { }` blocks. So if there is a `try { }` block outside the lambda and a `try { }` block inside the lambda, the latter can "leak" DU state up to the former via this field. As a result, a final variable that should still be DU at the completion of the outer `try { }` block can be incorrectly recorded as not DU, leading to the bogus "might already have been assigned" error.
>
> This patch fixes that by adding the necessary save & restore logic.
This pull request has now been integrated.
Changeset: d437c61f
Author: Archie Cobbs <acobbs at openjdk.org>
Committer: Vicente Romero <vromero at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/d437c61f5b77793606d73960eeaf98a091f14f6a
Stats: 49 lines in 2 files changed: 49 ins; 0 del; 0 mod
8305672: Surprising definite assignment error after JDK-8043179
Reviewed-by: kcr, vromero
-------------
PR: https://git.openjdk.org/jdk/pull/13366
More information about the compiler-dev
mailing list