llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

Divergent loop

Open Xazax-hun opened this issue 7 years ago • 2 comments

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

Xazax-hun avatar Sep 18 '18 23:09 Xazax-hun

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.

mgehre avatar Sep 19 '18 07:09 mgehre

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.

Xazax-hun avatar Jun 26 '19 23:06 Xazax-hun