aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/AST/ByteCode/Compiler.cpp
diff options
context:
space:
mode:
authorTimm Baeder <tbaeder@redhat.com>2025-09-23 09:47:23 +0200
committerGitHub <noreply@github.com>2025-09-23 09:47:23 +0200
commit242a1e2fb1b2ddefc8dcde73e22ce3f06f6a8188 (patch)
tree9165a1bcb6159049c609562d389df931d0289591 /clang/lib/AST/ByteCode/Compiler.cpp
parentebcf1bf2ecba6b25ece3c2bbddb4485e76189387 (diff)
downloadllvm-242a1e2fb1b2ddefc8dcde73e22ce3f06f6a8188.zip
llvm-242a1e2fb1b2ddefc8dcde73e22ce3f06f6a8188.tar.gz
llvm-242a1e2fb1b2ddefc8dcde73e22ce3f06f6a8188.tar.bz2
[clang][bytecode] Load value of non-lvalue ArraySubscriptExpr (#160024)
As happens in C. Fixes #158482
Diffstat (limited to 'clang/lib/AST/ByteCode/Compiler.cpp')
-rw-r--r--clang/lib/AST/ByteCode/Compiler.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/clang/lib/AST/ByteCode/Compiler.cpp b/clang/lib/AST/ByteCode/Compiler.cpp
index fafec47..7518cfd 100644
--- a/clang/lib/AST/ByteCode/Compiler.cpp
+++ b/clang/lib/AST/ByteCode/Compiler.cpp
@@ -1787,7 +1787,12 @@ bool Compiler<Emitter>::VisitArraySubscriptExpr(const ArraySubscriptExpr *E) {
return false;
if (DiscardResult)
return this->emitPopPtr(E);
- return true;
+
+ if (E->isGLValue())
+ return true;
+
+ OptPrimType T = classifyPrim(E);
+ return this->emitLoadPop(*T, E);
}
template <class Emitter>