bug icon indicating copy to clipboard operation
bug copied to clipboard

Inliner crash on Java 17 when using `-release`

Open lrytz opened this issue 3 years ago • 1 comments

object crash {
  def main(args: Array[String]): Unit = {
    val algo = "HmacSHA1"
    val charset = java.nio.charset.StandardCharsets.UTF_8
    val key = "totally secret key".getBytes(charset)
    val value = "totally real value".getBytes(charset)

    val mac = javax.crypto.Mac.getInstance(algo)
    mac.init(new javax.crypto.spec.SecretKeySpec(key, algo))
    val macced = mac.doFinal(value)

    println(new String(macced, charset))
  }
}
➜ sandbox sc -release 11 -opt:l:inline -opt-inline-from:'**' Test.scala
error: java.lang.IndexOutOfBoundsException
	at scala.tools.asm.tree.InsnList.get(InsnList.java:94)

Reported on https://users.scala-lang.org/t/solved-indexoutofboundsexception-in-scala-2-13-8-inliner/8583/4

lrytz avatar Jun 24 '22 07:06 lrytz

The linked PR uses retronym's clever hook to tweak the optimizer class path.

I didn't immediately see a way to handle "instructions are empty" in a graceful manner.

som-snytt avatar Sep 24 '22 06:09 som-snytt