summaryrefslogtreecommitdiff
path: root/src/theory/quantifiers/ematching
diff options
context:
space:
mode:
authorAndrew Reynolds <andrew.j.reynolds@gmail.com>2018-08-23 14:59:20 -0500
committerAndres Noetzli <andres.noetzli@gmail.com>2018-08-23 12:59:20 -0700
commit408bccf70b41b1f41c8be04ffe7f7002fb57e182 (patch)
treea9a11516fd218ed9c8b99a8c289e3f39b9f82207 /src/theory/quantifiers/ematching
parent4dc48596188c0550e625434cdd893d909810f9de (diff)
Fixing some coverity warnings (#2357)
Diffstat (limited to 'src/theory/quantifiers/ematching')
-rw-r--r--src/theory/quantifiers/ematching/inst_match_generator.cpp9
-rw-r--r--src/theory/quantifiers/ematching/trigger.cpp10
2 files changed, 14 insertions, 5 deletions
diff --git a/src/theory/quantifiers/ematching/inst_match_generator.cpp b/src/theory/quantifiers/ematching/inst_match_generator.cpp
index 192a6b433..eb3f6232d 100644
--- a/src/theory/quantifiers/ematching/inst_match_generator.cpp
+++ b/src/theory/quantifiers/ematching/inst_match_generator.cpp
@@ -627,7 +627,8 @@ InstMatchGeneratorMultiLinear::InstMatchGeneratorMultiLinear( Node q, std::vecto
// score is lexographic ( bound vars, shared vars )
int score_max_1 = -1;
int score_max_2 = -1;
- int score_index = -1;
+ unsigned score_index = 0;
+ bool set_score_index = false;
for( unsigned i=0; i<pats.size(); i++ ){
Node p = pats[i];
if( std::find( pats_ordered.begin(), pats_ordered.end(), p )==pats_ordered.end() ){
@@ -641,13 +642,17 @@ InstMatchGeneratorMultiLinear::InstMatchGeneratorMultiLinear( Node q, std::vecto
score_2++;
}
}
- if( score_index==-1 || score_1>score_max_1 || ( score_1==score_max_1 && score_2>score_max_2 ) ){
+ if (!set_score_index || score_1 > score_max_1
+ || (score_1 == score_max_1 && score_2 > score_max_2))
+ {
score_index = i;
+ set_score_index = true;
score_max_1 = score_1;
score_max_2 = score_2;
}
}
}
+ Assert(set_score_index);
//update the variable bounds
Node mp = pats[score_index];
for( unsigned i=0; i<var_contains[mp].size(); i++ ){
diff --git a/src/theory/quantifiers/ematching/trigger.cpp b/src/theory/quantifiers/ematching/trigger.cpp
index 3615ef6f4..b50deea11 100644
--- a/src/theory/quantifiers/ematching/trigger.cpp
+++ b/src/theory/quantifiers/ematching/trigger.cpp
@@ -838,6 +838,7 @@ Node Trigger::getInversion( Node n, Node x ) {
return x;
}else if( n.getKind()==PLUS || n.getKind()==MULT ){
int cindex = -1;
+ bool cindexSet = false;
for( unsigned i=0; i<n.getNumChildren(); i++ ){
if( !quantifiers::TermUtil::hasInstConstAttr(n[i]) ){
if( n.getKind()==PLUS ){
@@ -859,12 +860,15 @@ Node Trigger::getInversion( Node n, Node x ) {
}
x = Rewriter::rewrite( x );
}else{
- Assert( cindex==-1 );
+ Assert(!cindexSet);
cindex = i;
+ cindexSet = true;
}
}
- Assert( cindex!=-1 );
- return getInversion( n[cindex], x );
+ if (cindexSet)
+ {
+ return getInversion(n[cindex], x);
+ }
}
return Node::null();
}
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback