[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Soot typing failure



Ondrej Lhotak wrote:
public class test
{
    public void main() {
        if (null instanceof String)
            System.out.println("is String");
        else
            System.out.println("is not String");
    }
}

The code in ConstraintChecker generally assumes that expressions are of locals, however, in the above case, that is
obviously not true.


The constraint checker "Is Right(TM)".  Your problem is probably that typing
is applied after some optimizations.  IT SHOULD NOT.  I DISAGREE with the proposed
patch that Ondrej happily applied.


The code above should look like:


  loc_1 = null
  loc_2 = loc_1 instanceof String
  if (loc_2 != true) goto label_1
  loc_3 = "is String"
  loc4 = getstatic System.out
  loc4.invokevirtual println(loc_3)
  goto label_2
label_1:
  loc_5 = "is not String"
  loc_6 = getstatic System.out
  loc6.invokevirtual println(loc_5)
label_2:
  ...


Now, for this, the typing algorithm should yield the following assignment:


null_type  loc_1
boolean    loc_2
j.l.String loc_3
j.i.POS    loc_4
j.l.String loc_5
j.i.POS    loc_6

Or am I missing something?

Please send me the full "untyped jimple" source on which the typing algo
is applied, for each of the failing examples.  Thanks.

Etienne

--
Etienne M. Gagnon, Ph.D.             http://www.info.uqam.ca/~egagnon/
SableVM:                                       http://www.sablevm.org/
SableCC:                                       http://www.sablecc.org/