aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/AST/ByteCode/Pointer.cpp
diff options
context:
space:
mode:
authorTimm Baeder <tbaeder@redhat.com>2025-08-20 10:34:44 +0200
committerGitHub <noreply@github.com>2025-08-20 10:34:44 +0200
commite16ced3ef411531377fe7f90df82286cf1eb980e (patch)
tree738286c9425a542914b872021674ee66481629f3 /clang/lib/AST/ByteCode/Pointer.cpp
parent018c5ba161ead9b98c081bb91d54d59c4741f6db (diff)
downloadllvm-e16ced3ef411531377fe7f90df82286cf1eb980e.zip
llvm-e16ced3ef411531377fe7f90df82286cf1eb980e.tar.gz
llvm-e16ced3ef411531377fe7f90df82286cf1eb980e.tar.bz2
[clang][bytecode] Diagnose one-past-end reads from global arrays (#154484)
Fixes #154312
Diffstat (limited to 'clang/lib/AST/ByteCode/Pointer.cpp')
-rw-r--r--clang/lib/AST/ByteCode/Pointer.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/AST/ByteCode/Pointer.cpp b/clang/lib/AST/ByteCode/Pointer.cpp
index 821de3b..7dc6b0c 100644
--- a/clang/lib/AST/ByteCode/Pointer.cpp
+++ b/clang/lib/AST/ByteCode/Pointer.cpp
@@ -231,7 +231,7 @@ APValue Pointer::toAPValue(const ASTContext &ASTCtx) const {
UsePath = false;
// Build the path into the object.
- bool OnePastEnd = isOnePastEnd();
+ bool OnePastEnd = isOnePastEnd() && !isZeroSizeArray();
Pointer Ptr = *this;
while (Ptr.isField() || Ptr.isArrayElement()) {