Skip to content

Commit

Permalink
Merge pull request #1177 from bjjwwang/0821
Browse files Browse the repository at this point in the history
fix a bug in computeConstantOffset
  • Loading branch information
yuleisui authored Aug 28, 2023
2 parents 7c39cf4 + 9f67fe4 commit 1c73bab
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions svf/lib/MemoryModel/AccessPath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,15 @@ APOffset AccessPath::computeConstantOffset() const
else
{
APOffset offset = op->getSExtValue();
u32_t flattenOffset = SymbolTableInfo::SymbolInfo()->getFlattenedElemIdx(type, offset);
totalConstOffset += flattenOffset;
if (offset >= 0)
{
u32_t flattenOffset =
SymbolTableInfo::SymbolInfo()->getFlattenedElemIdx(type,
offset);
totalConstOffset += flattenOffset;
}
else
totalConstOffset += offset;
}
}
return totalConstOffset;
Expand Down

0 comments on commit 1c73bab

Please sign in to comment.