taie处理的if分支中字节码的对应行号有误
可复现的实例:
class A {
int x;
A foo(A a) {
if (a.x > 0) {
return null;
} else {
return new A();
}
}
public static void main(String[] args) {
A a = new A();
a.x = 2;
a.foo(a);
}
}
Taie生成的字节码结果(.tir
文件):
class A extends java.lang.Object {
int x;
A foo(A a) {
int temp$0, %intconst0;
A temp$1, temp$2;
[0@L6] temp$0 = a.<A: int x>;
[1@L6] %intconst0 = 0;
[2@L6] if (temp$0 > %intconst0) goto 4;
[3@L6] goto 7;
[4@L6] nop;
[5@L6] temp$1 = null;
[6@L7] return temp$1;
[7@L7] nop;
[8@L7] temp$2 = new A;
[9@L9] invokespecial temp$2.<A: void <init>()>();
[10@L9] return temp$2;
}
public static void main(java.lang.String[] args) {
A temp$0, a, temp$2;
int temp$1;
[0@L15] temp$0 = new A;
[1@L15] invokespecial temp$0.<A: void <init>()>();
[2@L15] a = temp$0;
[3@L16] temp$1 = 2;
[4@L16] a.<A: int x> = temp$1;
[5@L17] temp$2 = invokevirtual a.<A: A foo(A)>(a);
[6@L17] return;
}
void <init>() {
[0@L1] invokespecial %this.<java.lang.Object: void <init>()>();
[1@L1] return;
}
}
A::foo
函数中,new A
应该出现在第9行而不是第7行。