Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add coverage and fix struct gep accumulatedGepByteOffset() #1241

Merged
merged 6 commits into from
Nov 10, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix struct gep
  • Loading branch information
jiawei.wang committed Nov 9, 2023
commit 1ca4aeb09fb19b7ccb7e583e29dc6ed136913800
6 changes: 4 additions & 2 deletions svf/lib/MemoryModel/AccessPath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,10 @@ APOffset AccessPath::computeConstantByteOffset() const

const SVFConstantInt* op = SVFUtil::dyn_cast<SVFConstantInt>(value);
if (const SVFStructType* structType = SVFUtil::dyn_cast<SVFStructType>(type)) {
type2 = structType->getTypeInfo()->getOriginalElemType(op->getSExtValue());
totalConstOffset += type2->getLLVMByteSize();
for (u32_t structField = 0; structField < (u32_t)op->getSExtValue(); ++structField) {
type2 = structType->getTypeInfo()->getOriginalElemType(structField);
totalConstOffset += type2->getLLVMByteSize();
}
} else {
totalConstOffset += op->getSExtValue() * type2->getLLVMByteSize();
}
Expand Down