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 assertion MUSTALIAS(d,&obj) in cs_test/cs9.c should be MAYALIAS? #33

Open
taquangtrung opened this issue Feb 1, 2021 · 1 comment

Comments

@taquangtrung
Copy link

Hi,

For this cs_test/cs9.c, I think that the assertion MUSTALIAS(d,&obj) should be MAYALIAS only?

This is because d isn't be involved in the if-then branch if(t) {c=&obj; x =&c; y =&e;}, hence d cannot be an alias of &obj.
Could you advise if my understanding is correct?

Best regards,
Trung.

#include "aliascheck.h"
int obj, t,s;
int *k =&s;
void foo(int**, int**);
main(){
  int **x, **y;
  int *a, *b, *c, *d,*e;
  a = &t;
  x=&a; y =&b;
  foo(x,y);

  NOALIAS(a,b);
  MUSTALIAS(b,&obj);

  *b = 5;
  c=&t;
  c=&s;
  a=c;

  MUSTALIAS(a,c);

  if(t) {c=&obj; x =&c; y =&e;}
  else { x= &d; y = &d;}

  e = &t;
  foo(x,y);

  MAYALIAS(c,d);
  MUSTALIAS(d,&obj);           /// This should be MAYALIAS?
  MAYALIAS(a,c);
  NOALIAS(a,d);
  MAYALIAS(c,d);

  *e = 10;
}

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

yuleisui commented Feb 1, 2021

Just fixed. Thanks

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