llvm-project
llvm-project copied to clipboard
Divergent loop
In the following code the analysis diverge, the pset of sp oscillates between unkown and invalid:
struct stuff {
stuff();
stuff(const stuff&);
stuff *next;
};
void test() {
stuff s;
stuff *sp = &s;
while(true) {
sp = sp->next;
__lifetime_pset(sp);
}
}
True, since we started suppress warnings by making psets unknown, the iterations are not monotonic in the pset. I guess when comparing psets to see if we should iterate again, we should consider a (invalid) and (unknown) to be equal.
This problem cannot be reproduced at the moment as members treated as being static. But I do not close this issue so we can be aware of this in the future once field support is added.