Integrated: 8304694: Runtime exception thrown when break stmt is missing

Jan Lahoda jlahoda at openjdk.org
Mon Mar 27 15:05:26 UTC 2023


On Wed, 22 Mar 2023 16:14:34 GMT, Jan Lahoda <jlahoda at openjdk.org> wrote:

> For code like this:
> 
>     public static int runFallThrough(R6 r) {
>         switch (r) {
>             case R6(var v1, var v2) when v1 != 0: return 0;
>             case R6(var v1, var v2):
>         }
>         return 1;
>     }
> 
> 
> The execution falls through from the last case not outside the switch, but inside the fallback default case (that throws).
> 
> The current code is injecting breaks, but only for rule cases, and this situation where the last case needs a break is not handled. To simplify the code, it is now proposed to inject breaks at the beginning of the processing (rather than during processing/at the end) to all necessary cases.

This pull request has now been integrated.

Changeset: 138cdc92
Author:    Jan Lahoda <jlahoda at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/138cdc9283ae8f3367e51f0fe7e27833118dd7cb
Stats:     21 lines in 2 files changed: 15 ins; 2 del; 4 mod

8304694: Runtime exception thrown when break stmt is missing

Reviewed-by: vromero

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

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


More information about the compiler-dev mailing list