RFR: 8327839: Crash with unboxing and widening primitive conversion in switch
Andrey Turbanov
aturbanov at openjdk.org
Sat Mar 16 22:18:23 UTC 2024
On Tue, 12 Mar 2024 14:06:11 GMT, Aggelos Biboudis <abimpoudis at openjdk.org> wrote:
> In cases where the compiler needs to unbox a `long`, `float`, `double` and then run the exactness check, we were getting a crash. While the selector value is always boxed, the type (which controls the execution flow) was not, because the `selectorType` was wrong. This PR addresses this bug.
test/langtools/tools/javac/patterns/PrimitivePatternsSwitch.java line 121:
> 119: assertEquals(Float.MAX_VALUE, testUnboxingAndWideningFloat(Float.MAX_VALUE));
> 120: assertEquals(Float.MAX_VALUE, testUnboxingAndWideningFloatExplicitCast(Float.MAX_VALUE));
> 121: assertEquals(42f, testUnboxingAndWideningLong(42l));
Suggestion:
assertEquals(42f, testUnboxingAndWideningLong(42L));
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/18236#discussion_r1527165787
More information about the compiler-dev
mailing list