We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3e24991 commit 9a5a609Copy full SHA for 9a5a609
compiler-rt/lib/tysan/tysan.cpp
@@ -131,7 +131,9 @@ static bool isAliasingLegalUp(tysan_type_descriptor *TDA,
131
132
// This offset can't be negative. Therefore we must be accessing something
133
// partially inside the last type
134
- if (TDA->Struct.Members[Idx].Offset > OffsetA)
+ // We shouldn't check this if we are on the first member, Idx will underflow
135
+ // The first member can be offset in rare cases such as llvm::cl::Option
136
+ if (TDA->Struct.Members[Idx].Offset > OffsetA && Idx > 0)
137
Idx -= 1;
138
139
OffsetA -= TDA->Struct.Members[Idx].Offset;
0 commit comments