Integrated: 8266615: C2 incorrectly folds subtype checks involving an interface array
Tobias Hartmann
thartmann at openjdk.java.net
Tue May 18 12:24:56 UTC 2021
On Mon, 17 May 2021 12:55:06 GMT, Tobias Hartmann <thartmann at openjdk.org> wrote:
> C2 incorrectly folds the subtype checks in `TestInterfaceArraySubtypeCheck::test1/test2`. As a result, an unexpected `ClassCastException` is thrown at `checkcast` and `instanceof` returns a wrong result. The problem is in `Compile::static_subtype_check` where we incorrectly return `SSC_always_false` for the `MyInterface[] <: MyClassA[]` check because `MyClassA[]` is not a subtype of `MyInterface[]` (after checking that `MyInterface[]` is not a subtype of `MyClassA[]`).
>
> The fix is to check that `subelem` is not an interface. This is very old code and not a recent regression.
>
> Thanks,
> Tobias
This pull request has now been integrated.
Changeset: ce88b334
Author: Tobias Hartmann <thartmann at openjdk.org>
URL: https://git.openjdk.java.net/jdk/commit/ce88b334884b6cc76bd938a8a8e6a9b28a777cb8
Stats: 87 lines in 2 files changed: 85 ins; 0 del; 2 mod
8266615: C2 incorrectly folds subtype checks involving an interface array
Reviewed-by: kvn, neliasso
-------------
PR: https://git.openjdk.java.net/jdk/pull/4060
More information about the hotspot-compiler-dev
mailing list