Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to enable soot optimization in soot-fact-generator #6

Open
chennbnbnb opened this issue Aug 24, 2023 · 0 comments
Open

Failed to enable soot optimization in soot-fact-generator #6

chennbnbnb opened this issue Aug 24, 2023 · 0 comments

Comments

@chennbnbnb
Copy link

chennbnbnb commented Aug 24, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant