Skip to content

The assertion MUSTALIAS(d,&obj) in cs_test/cs9.c should be MAYALIAS? #33

@taquangtrung

Description

@taquangtrung

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;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions