Skip to content

Commit 2078016

Browse files
Disable assertions checking for constraint validity (#379)
Disable checks that were used to verify that the relationships between constant atom were valid. While we do not generally intend to rewrite code in a way that violates these relationships, it is possible for a user of 3C to manually modify their code so that it does while still having valid CheckedC code.
1 parent 8d30753 commit 2078016

File tree

1 file changed

+26
-22
lines changed

1 file changed

+26
-22
lines changed

clang/lib/3C/ConstraintVariables.cpp

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1136,12 +1136,12 @@ void PointerVariableConstraint::constrainOuterTo(Constraints &CS, ConstAtom *C,
11361136
if (*CA < *C) {
11371137
llvm::errs() << "Warning: " << CA->getStr() << " not less than "
11381138
<< C->getStr() << "\n";
1139-
assert(CA == CS.getWild()); // definitely bogus if not
1139+
//assert(CA == CS.getWild()); // definitely bogus if not
11401140
}
11411141
} else if (*C < *CA) {
11421142
llvm::errs() << "Warning: " << C->getStr() << " not less than "
11431143
<< CA->getStr() << "\n";
1144-
assert(CA == CS.getWild()); // definitely bogus if not
1144+
//assert(CA == CS.getWild()); // definitely bogus if not
11451145
}
11461146
}
11471147
}
@@ -1457,27 +1457,31 @@ static void createAtomGeq(Constraints &CS, Atom *L, Atom *R, std::string &Rsn,
14571457
VAL = clang::dyn_cast<VarAtom>(L);
14581458
VAR = clang::dyn_cast<VarAtom>(R);
14591459

1460-
// Check constant atom relationships hold
14611460
if (CAR != nullptr && CAL != nullptr) {
1462-
if (DoEqType) { // check equality, no matter the atom
1463-
assert(*CAR == *CAL && "Invalid: RHS ConstAtom != LHS ConstAtom");
1464-
} else {
1465-
if (CAL != Wild && CAR != Wild) { // pType atom, disregard CAct
1466-
assert(!(*CAL < *CAR) && "Invalid: LHS ConstAtom < RHS ConstAtom");
1467-
} else { // checked atom (Wild/Ptr); respect CAct
1468-
switch (CAct) {
1469-
case Same_to_Same:
1470-
assert(*CAR == *CAL && "Invalid: RHS ConstAtom != LHS ConstAtom");
1471-
break;
1472-
case Safe_to_Wild:
1473-
assert(!(*CAL < *CAR) && "LHS ConstAtom < RHS ConstAtom");
1474-
break;
1475-
case Wild_to_Safe:
1476-
assert(!(*CAR < *CAL) && "RHS ConstAtom < LHS ConstAtom");
1477-
break;
1478-
}
1479-
}
1480-
}
1461+
// These checks were used to verify that the relationships between constant
1462+
// atom were valid. While we do not generally intend to rewrite code in a
1463+
// way that violates these relationships, it is possible for a user of 3C
1464+
// to manually modify their code so that it does while still having valid
1465+
// CheckedC code.
1466+
//if (DoEqType) { // check equality, no matter the atom
1467+
// assert(*CAR == *CAL && "Invalid: RHS ConstAtom != LHS ConstAtom");
1468+
//} else {
1469+
// if (CAL != Wild && CAR != Wild) { // pType atom, disregard CAct
1470+
// assert(!(*CAL < *CAR) && "Invalid: LHS ConstAtom < RHS ConstAtom");
1471+
// } else { // checked atom (Wild/Ptr); respect CAct
1472+
// switch (CAct) {
1473+
// case Same_to_Same:
1474+
// assert(*CAR == *CAL && "Invalid: RHS ConstAtom != LHS ConstAtom");
1475+
// break;
1476+
// case Safe_to_Wild:
1477+
// assert(!(*CAL < *CAR) && "LHS ConstAtom < RHS ConstAtom");
1478+
// break;
1479+
// case Wild_to_Safe:
1480+
// assert(!(*CAR < *CAL) && "RHS ConstAtom < LHS ConstAtom");
1481+
// break;
1482+
// }
1483+
// }
1484+
//}
14811485
} else if (VAL != nullptr && VAR != nullptr) {
14821486
switch (CAct) {
14831487
case Same_to_Same:

0 commit comments

Comments
 (0)