JVM: Break infinite loop in finding meaningful instruction
during tail-call optimization.
There can be code, where all next instructions are non-meaningful and
there is a back-edge, for example, while(true){}. Previously, analyzer
incorrectly assumed, that this cannot happen. Now, it keeps track of
visited instructions and says, that there is no meaningful instruction
in such case.
#KT-56815 Fixed
This commit is contained in:
committed by
Space Team
parent
550b4f1f11
commit
b3890885c4
@@ -0,0 +1,27 @@
|
||||
// WITH_STDLIB
|
||||
|
||||
import kotlin.coroutines.*
|
||||
|
||||
suspend fun test() {
|
||||
Nexus.initialize1()
|
||||
while (true) { }
|
||||
}
|
||||
|
||||
object Nexus {
|
||||
suspend fun initialize1() {
|
||||
}
|
||||
}
|
||||
|
||||
fun builder(c: suspend () -> Unit) {
|
||||
c.startCoroutine(Continuation(EmptyCoroutineContext) {
|
||||
it.getOrThrow()
|
||||
})
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
builder {
|
||||
suspendCoroutine<Unit> {}
|
||||
test()
|
||||
}
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user