[clang] [llvm] [mlir] [DenseMap] Do not align pointer sentinel values (NFC) (PR #146595)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 7 06:18:22 PDT 2025
nikic wrote:
Reverted this due to ubsan errors like:
> /home/b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/include/llvm/IR/ValueHandle.h:286:64: runtime error: upcast of misaligned address 0xffffffffffffffff for type 'llvm::BasicBlock', which requires 8 byte alignment
The problem is basically code like this:
```
class Foo {
unsigned x;
};
class Bar : public Foo {};
Bar *test(Foo *ptr) {
return static_cast<Bar *>(reinterpret_cast<Foo *>(-1));
}
```
Where ubsan doesn't like the static_cast.
While DenseMap itself doesn't need the aligned pointers, it seems like too many other places end up depending on this.
https://github.com/llvm/llvm-project/pull/146595
More information about the llvm-commits
mailing list