================
@@ -6670,15 +6541,33 @@ bool InterpretOffsetOf(InterpState &S, CodePtr OpPC,
const OffsetOfExpr *E,
break;
}
case OffsetOfNode::Array: {
- // When generating bytecode, we put all the index expressions as Sint64
on
- // the stack.
int64_t Index = ArrayIndices[ArrayIndex];
+ if (Index < 0) {
+ S.FFDiag(S.Current->getLocation(OpPC),
+ diag::note_invalid_subexpr_in_const_expr)
+ << S.Current->getRange(OpPC);
+ return false;
+ }
----------------
tbaederr wrote:
```suggestion
if (Index < 0)
return Invalid(S, OpPC);
```
https://github.com/llvm/llvm-project/pull/204139
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits