[clang] [clang][Interp] Integral pointers (PR #84159)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Wed Mar 6 05:55:46 PST 2024
================
@@ -1505,12 +1509,17 @@ bool OffsetHelper(InterpState &S, CodePtr OpPC, const T &Offset,
return true;
}
- if (!CheckNull(S, OpPC, Ptr, CSK_ArrayIndex))
- return false;
+ if (!CheckNull(S, OpPC, Ptr, CSK_ArrayIndex)) {
+ // The CheckNul will have emitted a note already, but we only
+ // abort in C++, since this is fine in C.
+ if (S.getLangOpts().CPlusPlus)
+ return false;
+ }
// Arrays of unknown bounds cannot have pointers into them.
- if (!CheckArray(S, OpPC, Ptr))
+ if (!CheckArray(S, OpPC, Ptr)) {
return false;
+ }
----------------
AaronBallman wrote:
```suggestion
if (!CheckArray(S, OpPC, Ptr))
return false;
```
https://github.com/llvm/llvm-project/pull/84159
More information about the cfe-commits
mailing list