New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wrong local variable table for methods containing while loops #9179
Comments
Imported From: https://issues.scala-lang.org/browse/SI-9179?orig=1 |
@retronym said: That backend will become the default in 2.12. We aren't making non-critical bug fixes to GenASM anymore, so I'm going to mark this as fixed for 2.12. I'd appreciate if you could verify this under scala 2.11 compiling with
|
@lrytz said: |
@retronym said: |
Nikolay Tropin (niktrop) said: |
@lrytz said: |
Local variables defined outside of a while loop sometimes are not visible from the body of this loop in the debugger.
{code}object Example {
def main(args: Array[String]) {
var x = ""
while (x != null) {
foo()
x = null
}
bar()
}
def foo() {}
def bar() {}
}
{code}
Bytecode instructions of the method main:
{code} 0 ldc #16
2 astore_2
3 aload_2
4 ifnonnull 12 (+8)
7 aload_0
8 invokevirtual #19 <Example$.bar>
11 return
12 aload_0
13 invokevirtual #22 <Example$.foo>
16 aconst_null
17 astore_2
18 goto 3 (-15)
{code}
Local variable x has attributes start_pc = 3, length = 8 in the local variable table. So it is not visible for a debugger inside the while statement body, when instructions 12 - 18 are executed.
It seems that this problem occurs when while statement condition has the form
A != B
, where A and B are reference type expressions.The text was updated successfully, but these errors were encountered: