usx95 wrote:
This is mostly the right direction. There is still a major flow here: The BFS
needs a visited state set otherwise this is **exponential** as it traverses all
paths!
```cpp
void exponential_paths(bool c) {
int *s = nullptr;
{
int tgt = 42; // expected-note {{local variable 'tgt' is destroyed here}}
int *p = &tgt;
if (c) {} else {}
if (c) {} else {} // ... N times
s = p; // expected-note {{local variable 'p' aliases the storage of local
variable 'tgt'}}
}
int val = *s; // expected-warning {{local variable 'tgt' does not live long
enough}} \
// expected-note {{later used here}}
}
```
This is `O(2^N)` where `N` is the number of `if` blocks here.
We would need a state to avoid revisiting. I _think_ a `std::pair<const
CFGBlock *, OriginID>` should work fine.
https://github.com/llvm/llvm-project/pull/204592
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits