[Soot-list] Typing errors in Jimple/Soot
Venkatesh Prasad Ranganath
vranganath at sbcglobal.net
Tue Mar 8 18:19:24 EST 2005
Hi,
I'm trying to type the following valid Java program, but the type
inference is wrong.
public class Weird {
public static void main(String[] args) {
double[] d1 = null;
double[] d2 = new double[1];
foo(d1, d2);
}
static void foo(double[] d, double[] b) {
}
}
The generated Jimple is
public static void main(java.lang.String[])
{
java.lang.String[] r0;
null_type n0; <-----------------------
double[] r1;
r0 := @parameter0: java.lang.String[];
n0 = null;
r1 = newarray (double)[1];
staticinvoke <Weird: void foo(double[],double[])>(n0, r1);
return;
}
static void foo(double[], double[])
{
double[] r0, r1;
r0 := @parameter0: double[];
r1 := @parameter1: double[];
return;
}
Clearly, n0 can be typed as double[], but it is not.
Upon further exploration, I found that the TypeVariable instance
associated with n0 is plugged as the child of the TypeVariable instance
associated with the first argument position of the call to foo() in main
(). In spite of this, the type information is not propagated to n0.
Following in the dump from my debug sessions. Of course, my
customizations (ConstraintsCollector.java) do not create a type variable
for null constants, and that does not affect the typing algorithm.
n0 local assign[id:13,depth:0,approx:null,[parents:],[children:]]
@
n0 = null;
n0 [id:13,depth:0,approx:null,[parents:15],[children:]]
[id:15,depth:0,type:double[](14),approx:double[](14),[parents:0,2,3,14],
[children:13],arrayof:16]
@
staticinvoke <Weird: void foo(double[],double[])>(n0, r1);
Any clues/fixes?
--
Venkatesh Prasad Ranganath,
Dept. Computing and Information Science,
Kansas State University, US.
web: http://www.cis.ksu.edu/~rvprasad
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 307 bytes
Desc: This is a digitally signed message part
Url : http://www.sable.mcgill.ca/pipermail/soot-list/attachments/20050308/77be7448/attachment.bin
More information about the Soot-list
mailing list