[clang] [clang][Interp] Integral pointers (PR #84159)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 6 05:55:47 PST 2024


================
@@ -809,9 +809,9 @@ inline bool CmpHelperEQ<Pointer>(InterpState &S, CodePtr OpPC, CompareFn Fn) {
     // element in the same array are NOT equal. They have the same Base value,
     // but a different Offset. This is a pretty rare case, so we fix this here
     // by comparing pointers to the first elements.
-    if (!LHS.isDummy() && LHS.isArrayRoot())
+    if (!LHS.isZero() && !LHS.isDummy() && LHS.isArrayRoot())
       VL = LHS.atIndex(0).getByteOffset();
-    if (!RHS.isDummy() && RHS.isArrayRoot())
+    if (!RHS.isDummy() && !RHS.isDummy() && RHS.isArrayRoot())
----------------
AaronBallman wrote:

```suggestion
    if (!RHS.isZero() && !RHS.isDummy() && RHS.isArrayRoot())
```
Right? (Might be missing test coverage.)

https://github.com/llvm/llvm-project/pull/84159


More information about the cfe-commits mailing list