martinboehme wrote:

Finally getting back to this.

The reason this was causing tests to fail is really pretty obvious in 
hindsight: Different `StorageLocation`s may alias, so if the `StorageLocation`s 
for two `PointerValue`s are different, we can't assume that the pointers must 
compare unequal.

Here's an example:

```cxx
void f(int *p1, int *p2) {
  if (p1 == p2) {
    do_something();
  }
}
```

The framework initializes `p1` and `p2` with different storage locations, so 
the current state of this PR causes the comparison `p1 == p2` to be evaluated 
to a false literal, which in turn causes the `do_something()` block to be 
considered dead code. But this is nonsense: `p1` and `p2` may alias, so it's 
definitely possible that `do_something()` will be executed.

In summary, if the storage locations for two pointers are the same, we can 
return a true literal for the comparison, but if the storage locations are 
different, we need to return an atom.

I'll change the PR accordingly and will let you know once it's ready for 
another look.

https://github.com/llvm/llvm-project/pull/75170
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to