aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/AST/ByteCode/Pointer.cpp
diff options
context:
space:
mode:
authorTimm Baeder <tbaeder@redhat.com>2025-03-25 11:37:03 +0100
committerGitHub <noreply@github.com>2025-03-25 11:37:03 +0100
commita29b0d74a198a9c91d39b4d9224c242e1a22df18 (patch)
tree831ef007b0cf28d6af68d4cbf80cbc2a347471c4 /clang/lib/AST/ByteCode/Pointer.cpp
parentd4304d85f26984aa772fcddf1f34604e526a6683 (diff)
downloadllvm-a29b0d74a198a9c91d39b4d9224c242e1a22df18.zip
llvm-a29b0d74a198a9c91d39b4d9224c242e1a22df18.tar.gz
llvm-a29b0d74a198a9c91d39b4d9224c242e1a22df18.tar.bz2
[clang][bytecode] Fix base cast of nullptr without descriptor (#132909)
The missing descriptor should only happen if the pointer is null pointer.
Diffstat (limited to 'clang/lib/AST/ByteCode/Pointer.cpp')
-rw-r--r--clang/lib/AST/ByteCode/Pointer.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/lib/AST/ByteCode/Pointer.cpp b/clang/lib/AST/ByteCode/Pointer.cpp
index 8abdc54b..79b47c2 100644
--- a/clang/lib/AST/ByteCode/Pointer.cpp
+++ b/clang/lib/AST/ByteCode/Pointer.cpp
@@ -720,6 +720,10 @@ IntPointer IntPointer::atOffset(const ASTContext &ASTCtx,
IntPointer IntPointer::baseCast(const ASTContext &ASTCtx,
unsigned BaseOffset) const {
+ if (!Desc) {
+ assert(Value == 0);
+ return *this;
+ }
const Record *R = Desc->ElemRecord;
const Descriptor *BaseDesc = nullptr;