diff options
author | Timm Baeder <tbaeder@redhat.com> | 2025-08-20 07:09:20 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-08-20 07:09:20 +0200 |
commit | 32ba045bea95442e37302c17b344f7695b6520e7 (patch) | |
tree | f84b3fc9c12dbd676438d40df240eccf62a7c5b7 /clang/lib/AST/ByteCode/Pointer.cpp | |
parent | c6fbd122261396ea246cfd8fe5b999c232715e40 (diff) | |
download | llvm-32ba045bea95442e37302c17b344f7695b6520e7.zip llvm-32ba045bea95442e37302c17b344f7695b6520e7.tar.gz llvm-32ba045bea95442e37302c17b344f7695b6520e7.tar.bz2 |
[clang][bytecode] Fix comparing pointers to union members (#154342)
If one of them is a one-past-end pointer.
Diffstat (limited to 'clang/lib/AST/ByteCode/Pointer.cpp')
-rw-r--r-- | clang/lib/AST/ByteCode/Pointer.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/clang/lib/AST/ByteCode/Pointer.cpp b/clang/lib/AST/ByteCode/Pointer.cpp index 7c6eb74..89d9829 100644 --- a/clang/lib/AST/ByteCode/Pointer.cpp +++ b/clang/lib/AST/ByteCode/Pointer.cpp @@ -375,6 +375,8 @@ size_t Pointer::computeOffsetForComparison() const { } if (const Record *R = P.getBase().getRecord(); R && R->isUnion()) { + if (P.isOnePastEnd()) + ++Result; // Direct child of a union - all have offset 0. P = P.getBase(); continue; |