RFR: 8329115: Crash involving return from inner switch

Aggelos Biboudis abimpoudis at openjdk.org
Tue Mar 26 18:10:34 UTC 2024


When a `return` is used erroneously in a `switch`, attribution should continue for the `tree.expr` of a return node if exists.


int test() {
      return switch (new R1()) {
          case R1() -> {
              return switch (new R2()) { // crashes, instead it should just be the error: attempt to return out of a switch expression
                  case R2() -> 1;
              };
          }
      };
  }

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

Commit messages:
 - 8329115: Crash involving return from inner switch

Changes: https://git.openjdk.org/jdk/pull/18494/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=18494&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8329115
  Stats: 26 lines in 3 files changed: 26 ins; 0 del; 0 mod
  Patch: https://git.openjdk.org/jdk/pull/18494.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/18494/head:pull/18494

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


More information about the compiler-dev mailing list