diff options
author | Timm Baeder <tbaeder@redhat.com> | 2025-03-25 11:37:03 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-25 11:37:03 +0100 |
commit | a29b0d74a198a9c91d39b4d9224c242e1a22df18 (patch) | |
tree | 831ef007b0cf28d6af68d4cbf80cbc2a347471c4 /clang/lib/AST/ByteCode/Pointer.cpp | |
parent | d4304d85f26984aa772fcddf1f34604e526a6683 (diff) | |
download | llvm-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.cpp | 4 |
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; |