Skip to content

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

@taquangtrung

Description

@taquangtrung

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

}

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