Node v = val.getModelValue(it->second);
Trace("sets-model") << "Cardinality of " << eqc << " is " << v
<< std::endl;
- Assert(v.getConst<Rational>() <= LONG_MAX)
- << "Exceeded LONG_MAX in sets model";
- unsigned vu = v.getConst<Rational>().getNumerator().toUnsignedInt();
+ if (v.getConst<Rational>() > UINT32_MAX)
+ {
+ std::stringstream ss;
+ ss << "The model for " << eqc << " was computed to have cardinality "
+ << v << ". We only allow sets up to cardinality " << UINT32_MAX;
+ throw LogicException(ss.str());
+ }
+ std::uint32_t vu = v.getConst<Rational>().getNumerator().toUnsignedInt();
Assert(els.size() <= vu);
NodeManager* nm = NodeManager::currentNM();
if (elementType.isInterpretedFinite())
std::map< Node, Node > processed;
//step 1 : get all values for known lengths
std::vector< Node > lts_values;
- std::map<unsigned, Node> values_used;
+ std::map<std::size_t, Node> values_used;
std::vector<Node> len_splits;
for( unsigned i=0; i<col.size(); i++ ) {
Trace("strings-model") << "Checking length for {";
else
{
// must throw logic exception if we cannot construct the string
- if (len_value.getConst<Rational>() > Rational(String::maxSize()))
+ if (len_value.getConst<Rational>() > String::maxSize())
{
std::stringstream ss;
- ss << "Cannot generate model with string whose length exceeds UINT32_MAX";
+ ss << "The model was computed to have strings of length " << len_value
+ << ". We only allow strings up to length " << String::maxSize();
throw LogicException(ss.str());
}
- unsigned lvalue =
+ std::size_t lvalue =
len_value.getConst<Rational>().getNumerator().toUnsignedInt();
- std::map<unsigned, Node>::iterator itvu = values_used.find(lvalue);
+ auto itvu = values_used.find(lvalue);
if (itvu == values_used.end())
{
values_used[lvalue] = lts[i];
if( !pure_eq.empty() ){
if( lts_values[i].isNull() ){
// start with length two (other lengths have special precendence)
- unsigned lvalue = 2;
+ std::size_t lvalue = 2;
while( values_used.find( lvalue )!=values_used.end() ){
lvalue++;
}
; COMMAND-LINE: --lang=smt2.6 --check-models
-; EXPECT: (error "Cannot generate model with string whose length exceeds UINT32_MAX")
+; SCRUBBER: sed -E 's/of length [0-9]+/of length LENGTH/'
+; EXPECT: (error "The model was computed to have strings of length LENGTH. We only allow strings up to length 4294967295")
; EXIT: 1
(set-logic SLIA)
(declare-fun x () String)