@@ -179,7 +179,8 @@ static bool isAliasingLegalWithOffset(tysan_type_descriptor *AccessTD,
179
179
}
180
180
181
181
static bool isAliasingLegal (tysan_type_descriptor *TDA,
182
- tysan_type_descriptor *TDB) {
182
+ tysan_type_descriptor *TDB,
183
+ int OffsetB = 0 ) {
183
184
if (TDA == TDB || !TDB || !TDA)
184
185
return true ;
185
186
@@ -190,7 +191,8 @@ static bool isAliasingLegal(tysan_type_descriptor *TDA,
190
191
// TDB may have been adjusted by offset TDAOffset in the caller to point to
191
192
// the outer type. Check for aliasing with and without adjusting for this
192
193
// offset.
193
- return isAliasingLegalUp (TDA, TDB) || isAliasingLegalUp (TDB, TDA);
194
+ return isAliasingLegalUp (TDA, TDB) || isAliasingLegalUp (TDB, TDA) ||
195
+ isAliasingLegalWithOffset (TDA, TDB, OffsetB);
194
196
}
195
197
196
198
namespace __tysan {
@@ -267,7 +269,7 @@ __tysan_check(void *addr, int size, tysan_type_descriptor *td, int flags) {
267
269
OldTDPtr -= i;
268
270
OldTD = *OldTDPtr;
269
271
270
- if (!isAliasingLegal (td, OldTD) && ! isAliasingLegalWithOffset (td, OldTD , i))
272
+ if (!isAliasingLegal (td, OldTD, i))
271
273
reportError (addr, size, td, OldTD, AccessStr,
272
274
" accesses part of an existing object" , -i, pc, bp, sp);
273
275
0 commit comments