Issue 165762
Summary core.StackAddressEscape checker produce invalid detection
Labels new issue
Assignees
Reporter earnol
    The core.StackAddressEscape produce invalid disgnostics (false positive) in the following case:
```
#include <stdint.h>

class LocalClass;
class VEI {
public:
 VEI():pLocal(nullptr) {}  
  LocalClass *pLocal;
};

class LocalClass {
public:
    LocalClass(VEI *v):p(v) {}
    VEI *p;
    ~LocalClass() { p->pLocal = nullptr; }
    void updateVei() {
        if(p->pLocal != this) {
          p->pLocal = this;
        }
    }
};

intptr_t funct(VEI *vei) {
  LocalClass ohRly(vei);
  ohRly.updateVei();
  return (intptr_t)vei;
}

int main(void) {
    VEI vei;
    intptr_t res = funct(&vei);
    return res > 0x7FFF;
}
```
The problem is the program context is analyzed at the time of return (line 32) but actual removal of local variable reference happens in the destructor and then context is actually destroyed.



_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to