[PATCH] D137082: [clang][Interp] Fix dereferencing arrays with no offset applied
Timm Bäder via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 3 00:43:21 PDT 2022
tbaeder added inline comments.
================
Comment at: clang/lib/AST/Interp/Interp.h:966-967
return false;
- S.Stk.push<T>(Ptr.deref<T>());
+ // When getting the first value of an array, we need to offset to the
+ // first element.
+ if (Ptr.inArray() && Ptr.isRoot())
----------------
aaron.ballman wrote:
> So why don't we need to do this dance for `Store`/`StorePop`?
We do, I just realized.
It might make more sense to do this in `Pointer::deref()` directly, so 'deref()`'ing an array always returns the first element.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D137082/new/
https://reviews.llvm.org/D137082
More information about the cfe-commits
mailing list