[compiler-rt] [TySan] Fix struct access with different bases (PR #120412)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 28 01:57:29 PST 2024


================
@@ -131,6 +131,14 @@ static bool isAliasingLegalUp(tysan_type_descriptor *TDA,
           break;
       }
 
+      // This offset can't be negative. Therefore we must be accessing something
+      // partially inside the last type
+      // We shouldn't check this if we are on the first member, Idx will
+      // underflow The first member can be offset in rare cases such as
----------------
fhahn wrote:

Is it `Idx` that underflows or `OffsetA`? `Idx` will only get incremented AFAICT. Would this be cleared if combined with the search loop above, maybe with a flag indicating that we took the exit due to the offset of the member begin larger than OffsetA?

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


More information about the llvm-commits mailing list