Skip to content

update Assignment-2 template#79

Open
yuleisui wants to merge 1 commit into
SVF-tools:mainfrom
yuleisui:main
Open

update Assignment-2 template#79
yuleisui wants to merge 1 commit into
SVF-tools:mainfrom
yuleisui:main

Conversation

@yuleisui

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings July 24, 2026 00:28

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Assignment 2 C++ symbolic execution components by (1) improving constant-object expression creation to resolve constant-ness against the base object, and (2) modifying the Assignment 2 C++ template logic for statement translation.

Changes:

  • Update Z3SSEMgr::createExprForObjVar to perform constant-type checks against the resolved base object (getBaseObject) rather than the original objVar.
  • Remove existing constraint-generation logic for BinaryOPStmt, SelectStmt, and PhiStmt in SSE::handleNonBranch, replacing it with TODO stubs.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
Assignment-2/CPP/Z3SSEMgr.cpp Adjusts constant handling to dyn_cast/isa against the resolved base object to better handle GEPs into constant aggregates.
Assignment-2/CPP/Assignment_2.cpp Replaces previously implemented translations for BinaryOp/Select/Phi with TODO placeholders, removing solver constraints for these statements.
Comments suppressed due to low confidence (2)

Assignment-2/CPP/Assignment_2.cpp:129

  • SelectStmt handling was removed and replaced with a TODO, so SSA select expressions will no longer constrain the result value. This can lead to incorrect path feasibility and incorrect values flowing into subsequent constraints. Restore the select translation or provide an equivalent implementation.
		else if (const SelectStmt *select = SVFUtil::dyn_cast<SelectStmt>(stmt)) {
			// TODO: implement SelectStmt handler here
		}

Assignment-2/CPP/Assignment_2.cpp:132

  • PhiStmt handling was removed and replaced with a TODO, so SSA phi nodes will no longer be translated into constraints. This breaks value propagation across CFG joins and can invalidate subsequent constraints built on the phi result. Restore the previous phi translation logic or provide an equivalent implementation.
		else if (const PhiStmt *phi = SVFUtil::dyn_cast<PhiStmt>(stmt)) {
			// TODO: implement PhiStmt handler here
		}

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 119 to 122
else if (const BinaryOPStmt *binary = SVFUtil::dyn_cast<BinaryOPStmt>(stmt))
{
expr op0 = getZ3Expr(binary->getOpVarID(0));
expr op1 = getZ3Expr(binary->getOpVarID(1));
expr res = getZ3Expr(binary->getResID());
switch (binary->getOpcode())
{
case BinaryOperator::Add:
addToSolver(res == op0 + op1);
break;
case BinaryOperator::Sub:
addToSolver(res == op0 - op1);
break;
case BinaryOperator::Mul:
addToSolver(res == op0 * op1);
break;
case BinaryOperator::SDiv:
addToSolver(res == op0 / op1);
break;
case BinaryOperator::SRem:
addToSolver(res == op0 % op1);
break;
case BinaryOperator::Xor:
addToSolver(res == bv2int(int2bv(32, op0) ^ int2bv(32, op1), 1));
break;
case BinaryOperator::And:
addToSolver(res == bv2int(int2bv(32, op0) & int2bv(32, op1), 1));
break;
case BinaryOperator::Or:
addToSolver(res == bv2int(int2bv(32, op0) | int2bv(32, op1), 1));
break;
case BinaryOperator::AShr:
addToSolver(res == bv2int(ashr(int2bv(32, op0), int2bv(32, op1)), 1));
break;
case BinaryOperator::Shl:
addToSolver(res == bv2int(shl(int2bv(32, op0), int2bv(32, op1)), 1));
break;
default:
assert(false && "implement this part");
}
// TODO: implement BinaryOPStmt handler here
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants