[compiler-rt] [TySan] Fix false positives with derived classes (PR #126260)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 13 04:55:58 PDT 2025


================
@@ -102,20 +102,8 @@ static tysan_type_descriptor *getRootTD(tysan_type_descriptor *TD) {
   return RootTD;
 }
 
-static bool isAliasingLegalUp(tysan_type_descriptor *TDA,
-                              tysan_type_descriptor *TDB, int TDAOffset) {
-  // Walk up the tree starting with TDA to see if we reach TDB.
-  uptr OffsetA = 0, OffsetB = 0;
-  if (TDB->Tag == TYSAN_MEMBER_TD) {
-    OffsetB = TDB->Member.Offset;
-    TDB = TDB->Member.Base;
-  }
-
-  if (TDA->Tag == TYSAN_MEMBER_TD) {
-    OffsetA = TDA->Member.Offset - TDAOffset;
-    TDA = TDA->Member.Base;
-  }
-
+bool walkAliasTree(tysan_type_descriptor *TDA, tysan_type_descriptor *TDB,
----------------
fhahn wrote:

Should still be static?

```suggestion
static bool walkAliasTree(tysan_type_descriptor *TDA, tysan_type_descriptor *TDB,
```

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


More information about the llvm-commits mailing list