[clang][Interp] Fix Pointer::toAPValue() for expressions
authorTimm Bäder <tbaeder@redhat.com>
Mon, 16 Jan 2023 16:58:22 +0000 (17:58 +0100)
committerTimm Bäder <tbaeder@redhat.com>
Fri, 3 Feb 2023 13:30:05 +0000 (14:30 +0100)
Differential Revision: https://reviews.llvm.org/D141858

clang/lib/AST/Interp/Pointer.cpp

index e25b4f8..8f1dfa3 100644 (file)
@@ -103,6 +103,10 @@ APValue Pointer::toAPValue() const {
     if (isUnknownSizeArray()) {
       IsOnePastEnd = false;
       Offset = CharUnits::Zero();
+    } else if (Desc->asExpr()) {
+      // Pointer pointing to a an expression.
+      IsOnePastEnd = false;
+      Offset = CharUnits::Zero();
     } else {
       // TODO: compute the offset into the object.
       Offset = CharUnits::Zero();