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

Two MUSTALIAS assertions in path_tests/path1.c could not hold together? #22

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

Comments

@taquangtrung
Copy link

Hi,

For the test case path_tests/path1.c, I think the two assertions MUSTALIAS(c,&e) and MUSTALIAS(d,&f) could not hold together.

I'm not sure how to evaluate the condition if (x), when x is declared by int **x.

But, if x is considered a valid memory address (not NULL), then only the then branch is executed, hence the second assertion should be NOALIAS(d, &f).

If x is considered an arbitrary value, then both the two branches then and else could be executed, hence, the two assertions should both be MAYALIAS.

Could you advise if my understanding is correct?

Thank you!

// path_tests/path1.c

#include "aliascheck.h"

void foo(int**, int*);
main(){
    int **x, *y;
    int  *c, *d,e,f;
    if(x) { x =&c; y =&e;}
    else { x= &d; y = &f;}

    foo(x,y);

    MUSTALIAS(c,&e);
    MUSTALIAS(d,&f);
    NOALIAS(c,&f);
    NOALIAS(d,&e);
	
}

void foo(int **p, int *q){
	*p = q;
}
@yuleisui
Copy link
Collaborator

Correct. MAYALIAS is appropriate. Just fixed

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