pascal-lab/Tai-e-assignments

improvement of assignment2

Z3ratu1 opened this issue · 1 comments

I think when some value*0, the result should be 0, same for 0/some value and 0 % some value, but OJ judged me wrong in testcase Switch.java

class Switch{
    int switch1(int x, int y){
        int a = 0;
        switch(x){
            case 1:
                a-=y;
                break;
            case 2:
                a+=y;
                break;
            case 3:
                a*=y;
                break;
            case 4:
                a/=y;
                break;
            default:
                a = a-1;
        }
        a = a+x;
        return a;
    }

in case3/4 a must be zero, but the answer is NAC

------ Failure on <Switch: int switch1(int,int)> ------
Expected: [9@L12] a = a * y; {a=NAC, x=NAC, y=NAC}
Expected: [10@L13] goto 21; {a=NAC, x=NAC, y=NAC}

I guess maybe it only considers the general and abstract value in the lattice, rather than the concrete case...