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

fix bitvec err for sse #1156

Merged
merged 2 commits into from
Jul 25, 2023
Merged
Changes from all commits
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
20 changes: 8 additions & 12 deletions svf/include/AbstractExecution/BoundedZ3Expr.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

#ifndef SVF_BOUNDEDZ3EXPR_H
#define SVF_BOUNDEDZ3EXPR_H
#define MaxBvLen 64

#include "Util/Z3Expr.h"

Expand Down Expand Up @@ -248,20 +249,17 @@ class BoundedZ3Expr : public Z3Expr

friend BoundedZ3Expr operator^(const BoundedZ3Expr &lhs, const BoundedZ3Expr &rhs)
{
const auto &maxBvLen = std::max(lhs.bvLen(), rhs.bvLen());
return bv2int(int2bv(maxBvLen, lhs.getExpr()) ^ int2bv(maxBvLen, rhs.getExpr()), true);
return bv2int(int2bv(MaxBvLen, lhs.getExpr()) ^ int2bv(MaxBvLen, rhs.getExpr()), true);
}

friend BoundedZ3Expr operator&(const BoundedZ3Expr &lhs, const BoundedZ3Expr &rhs)
{
const auto &maxBvLen = std::max(lhs.bvLen(), rhs.bvLen());
return bv2int(int2bv(maxBvLen, lhs.getExpr()) & int2bv(maxBvLen, rhs.getExpr()), true);
return bv2int(int2bv(MaxBvLen, lhs.getExpr()) & int2bv(MaxBvLen, rhs.getExpr()), true);
}

friend BoundedZ3Expr operator|(const BoundedZ3Expr &lhs, const BoundedZ3Expr &rhs)
{
const auto &maxBvLen = std::max(lhs.bvLen(), rhs.bvLen());
return bv2int(int2bv(maxBvLen, lhs.getExpr()) | int2bv(maxBvLen, rhs.getExpr()), true);
return bv2int(int2bv(MaxBvLen, lhs.getExpr()) | int2bv(MaxBvLen, rhs.getExpr()), true);
}

friend BoundedZ3Expr ashr(const BoundedZ3Expr &lhs, const BoundedZ3Expr &rhs)
Expand All @@ -274,8 +272,7 @@ class BoundedZ3Expr : public Z3Expr
return ite(lhs.getExpr() >= 0, BoundedZ3Expr(0), BoundedZ3Expr(-1));
else
{
const auto &maxBvLen = std::max(lhs.bvLen(), rhs.bvLen());
return bv2int(ashr(int2bv(maxBvLen, lhs.getExpr()), int2bv(maxBvLen, rhs.getExpr())), true);
return bv2int(ashr(int2bv(MaxBvLen, lhs.getExpr()), int2bv(MaxBvLen, rhs.getExpr())), true);
}
}

Expand All @@ -289,15 +286,13 @@ class BoundedZ3Expr : public Z3Expr
return ite(lhs.getExpr() >= 0, plus_infinity(), minus_infinity());
else
{
const auto &maxBvLen = std::max(lhs.bvLen(), rhs.bvLen());
return bv2int(shl(int2bv(maxBvLen, lhs.getExpr()), int2bv(maxBvLen, rhs.getExpr())), true);
return bv2int(shl(int2bv(MaxBvLen, lhs.getExpr()), int2bv(MaxBvLen, rhs.getExpr())), true);
}
}

friend BoundedZ3Expr lshr(const BoundedZ3Expr &lhs, const BoundedZ3Expr &rhs)
{
const auto &maxBvLen = std::max(lhs.bvLen(), rhs.bvLen());
return bv2int(lshr(int2bv(maxBvLen, lhs.getExpr()), int2bv(maxBvLen, rhs.getExpr())), true);
return bv2int(lshr(int2bv(MaxBvLen, lhs.getExpr()), int2bv(MaxBvLen, rhs.getExpr())), true);
}

friend BoundedZ3Expr int2bv(u32_t n, const BoundedZ3Expr &e)
Expand Down Expand Up @@ -394,3 +389,4 @@ struct std::hash<SVF::BoundedZ3Expr>
}
};
#endif //SVF_BOUNDEDZ3EXPR_H