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

Real arithmetic is used even on integer values (Numerical analysis of Java programs) #16

Open
maemre opened this issue Jan 16, 2019 · 1 comment

Comments

@maemre
Copy link

maemre commented Jan 16, 2019

It seems like Jandom uses real arithmetic rather than integer arithmetic when abstracting integer arithmetic operations. When I run numerical analysis (using BoxDouble domain) on Jimple code of JimpleTest.idiv() from Java examples, I get the following output:

    static void idiv()
    {
        byte b0, b1;
        int i2;

/*[ [ -∞ ≤ b0 ≤ +∞ , -∞ ≤ b1 ≤ +∞ , -∞ ≤ i2 ≤ +∞ ]types: byte,byte,int ]*/
        b0 = 15;

/*[ [ b0 = 15.0 , -∞ ≤ b1 ≤ +∞ , -∞ ≤ i2 ≤ +∞ ]types: byte,byte,int ]*/
        b1 = 2;

/*[ [ b0 = 15.0 , b1 = 2.0 , -∞ ≤ i2 ≤ +∞ ]types: byte,byte,int ]*/
        i2 = b0 / b1;

/*[ [ b0 = 15.0 , b1 = 2.0 , i2 = 7.5 ]types: byte,byte,int ]*/
        return;
    }
/* Output: [ b0 = 15.0 , b1 = 2.0 , i2 = 7.5 ]types: byte,byte,int */

Notice that the analysis concludes that i2 = 7.5 at the end but i2 = 7 if you run the program because of integer division.

BoxDouble over reals and Parallelotope over rationals have different manifestations of the same issue as well.

@amato-gianluca
Copy link
Member

You are right, there is a problem there. I will try to fix it as soon as I come back to work (a couple of weeks).

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

2 participants