[compiler-rt] [hwasan] Fix DCHECK with COMPILER_RT_DEBUG=ON (PR #84612)

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 13 14:02:00 PDT 2024


================
@@ -140,7 +140,7 @@ __attribute__((always_inline, nodebug)) static inline uptr ShortTagSize(
 
 __attribute__((always_inline, nodebug)) static inline bool
 PossiblyShortTagMatches(tag_t mem_tag, uptr ptr, uptr sz) {
-  DCHECK(IsAligned(ptr, kShadowAlignment));
+  DCHECK(IsAligned(ptr, sz));
----------------
vitalybuka wrote:

I suppose this one should guaranty that we can't get here with wrong alignment

```
IRBuilder<> IRB(O.getInsn());
  if (!O.TypeStoreSize.isScalable() && isPowerOf2_64(O.TypeStoreSize) &&
      (O.TypeStoreSize / 8 <= (1ULL << (kNumberOfAccessSizes - 1))) &&
      (!O.Alignment || *O.Alignment >= Mapping.getObjectAlignment() ||
       *O.Alignment >= O.TypeStoreSize / 8)) {
```

But I am not sure how :)

https://github.com/llvm/llvm-project/pull/84612


More information about the llvm-commits mailing list