[Soot-list] one bug in the MHGPostDominatorsFinder?

Eric Bodden bodden at st.informatik.tu-darmstadt.de
Wed Oct 28 04:29:16 EDT 2009


Jiangfan thanks a lot for the detailed error report. Surely the result
that you are seeing is incorrect. However, I remember fixing something
in MHGDomintorsFinder some weeks ago and I wonder if you are actually
describing the same problem that I fixed.

Are you using Soot 2.3.0? If so, please try out the nightly build:
http://plg.uwaterloo.ca/~olhotak/build/

I have trouble reproducing the error you see, which makes me believe
that it may already have been fixed.


Eric

--
Eric Bodden
Software Technology Group, Technische Universität Darmstadt, Germany
Tel: +49 6151 16-5478    Fax: +49 6151 16-5410
Mailing Address: S2|02 A209, Hochschulstraße 10, 64289 Darmstadt



2009/10/27 jiangfan shi <jiangfan.shi at gmail.com>:
> Dear All,
> I want to use the MHGPostDominatorsFinder to compute the post dominator and
> immediate post dominator. But when I apply it to the following code, I found
> there maybe some errors in the result. Correct me, if I am wrong here.
> The analyzed Java source code:
> package testPDG;
> public class forSootDiscussion {
> public static void main(String[] args ){
> int i=1;
> int sum=0;
> if(i<10){
> sum=i+10;
> sum=sum*100;
> }else{
> i=i-10;
> sum=sum*101;
> }
> i=0;
> }
> }
> The transformed Jimple source code:
>   public static void main(java.lang.String[])
>     {
>         java.lang.String[] r0;
>         byte b0, b1;
>         int i2, i3, i4, i5;
>         boolean z0;
>         r0 := @parameter0: java.lang.String[];
>         b0 = 1;
>         b1 = 0;
>         if b0 >= 10 goto label0;
>         i2 = b0 + 10;
>         i3 = i2 * 100;
>         goto label1;
>      label0:
>         i4 = b0 + -10;
>         i5 = b1 * 101;
>      label1:
>         z0 = 0;
>         return;
>     }
> The main code snippet of using MHGPostDominatorsFinder is the following:
>
> if (method.getSignature().contains("main")) {
> Body b = method.retrieveActiveBody();
> UnitGraph g = new ExceptionalUnitGraph(b);
> MHGPostDominatorsFinder dom = new MHGPostDominatorsFinder(g);
> /**
>  * print out if statement's post dominators
>  */
> Iterator unitIt = g.iterator();
> while (unitIt.hasNext()) {
> Unit s = (Unit) unitIt.next();
> Stmt tmp = (Stmt) s;
> if (tmp instanceof IfStmt) {
> IfStmt ifstmt = (IfStmt) tmp;
> List<Stmt> tmplist = dom.getDominators(ifstmt);
> System.out.println(ifstmt.toString()
> + "'s post domainators are shown below");
> for (int i = 0; i < tmplist.size(); i++) {
> System.out.println(tmplist.get(i));
> }
> System.out
> .println(ifstmt.toString()
> + "'s immediate post domainator is shown below");
> Stmt tmpdom = (Stmt) dom
> .getImmediateDominator(ifstmt);
> System.out.println(tmpdom.toString());
> }
> }
> }
> I attached the CFG of the Jimple in this email.
> The analyzed results for the if statement "if b0 >= 10 goto i4 = b0 + -10"
> are shown below:
> The immediate post dominator: return
> The post dominator set: return, if b0 >= 10 goto i4 = b0 + -10.
> Based on my understanding, the immediate post dominator should be "z0=0",
> which is also missing in the post dominator set.
> Do I miss any options for the MHGPostDominatorsFinder?
> Any suggestions and comments are appreciated.
> jiangfan
>
>
>
> _______________________________________________
> Soot-list mailing list
> Soot-list at sable.mcgill.ca
> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
>
>


More information about the Soot-list mailing list