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

The second assertion MAYALIAS(z, &obj1) of cs_tests/cs8.c should be NOALIAS? #30

Open
taquangtrung opened this issue Nov 18, 2020 · 1 comment

Comments

@taquangtrung
Copy link

Hi,

For this test case, I think the second assertion MAYALIAS(z, &obj1) should be NOALIAS?

This is because in the if-else branch, both a and b are equal to &z, and when calling foo(a,b), the *b will be updated to &obj2. Hence, z and &obj2 are MayAlias, but z and &obj1 are NoAlias.

// cs_tests/cs8.c

#include "aliascheck.h"
int obj1,obj2;
void foo(int **p, int **q){
	*p = &obj1;
	*q = &obj2;
}

int main(){
	int **a,**b,*x,*y,*z;
	if(a){
		a = &x;
		b = &y;
	}
	else{
		a = &z;
		b = &z;
	}
	foo(a,b);
    MAYALIAS(x,&obj1);
    MAYALIAS(z,&obj1);
    MAYALIAS(y,&obj2);
    MAYALIAS(z,&obj2);
    NOALIAS(x,&obj2);

}
@yuleisui
Copy link
Collaborator

Yes, you are correct. But the underlying analysis is calling-context-sensitive but not branch-insensitive.... Feel free to develop more precise analysis derived from this case:)

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