doop icon indicating copy to clipboard operation
doop copied to clipboard

Failed to enable soot optimization in soot-fact-generator

Open chennbnbnb opened this issue 2 years ago • 0 comments

Hi, I want to enable soot soot optimization for dead code elimination, so I insert some code into org.clyze.doop.soot.Main.produceFacts(), But after running, it is found that the generated fact has not been optimized, and dead code still exists

image

here is my test case

public class A {

    public static String source() {
        return new String();
    }

    public static void sink(String var) {
        ; 
    }
 

    public static void main(String[] args) throws Exception {    
        String str = source();
        String bar;
        int x = 123;
        if (x==456){
            bar = str;
        }else{
            bar = "XXX";
        }
        sink(bar);
    }
}

if I directly run soot with cmd soot -f S -pp -cp . A -optimize, the shimple which soot generated is optimized:

public class A extends java.lang.Object
{

   ...

    public static void main(java.lang.String[]) throws java.lang.Exception
    {
        java.lang.String[] r0;
        java.lang.String r1, r1_1, r1_2;

        r0 := @parameter0: java.lang.String[];

        goto label1;

        r1 = staticinvoke <A: java.lang.String source()>();

        goto label2;

     label1:
        r1_1 = "XXX";

     label2:
        r1_2 = "XXX";

        staticinvoke <A: void sink(java.lang.String)>("XXX");

        return;
    }
}

I don't why those pack setting don't work in doop

chennbnbnb avatar Aug 24 '23 06:08 chennbnbnb