diff --git a/src/util/format_expr.cpp b/src/util/format_expr.cpp index 35c9e828749..d89ebc6151b 100644 --- a/src/util/format_expr.cpp +++ b/src/util/format_expr.cpp @@ -27,6 +27,7 @@ Author: Daniel Kroening, kroening@kroening.com #include "string2int.h" #include "string_utils.h" +#include #include #include diff --git a/src/util/irep_hash_container.cpp b/src/util/irep_hash_container.cpp index ee8bc99d90c..bb88e0ae001 100644 --- a/src/util/irep_hash_container.cpp +++ b/src/util/irep_hash_container.cpp @@ -52,7 +52,9 @@ void irep_hash_container_baset::pack( if(full) { - packed.reserve(1 + 1 + sub.size() + named_sub.size()); + // we pack: the irep id, the sub size, the subs, the named-sub size, and + // each of the named subs with their ids + packed.reserve(1 + 1 + sub.size() + 1 + named_sub.size() * 2); packed.push_back(irep_id_hash()(irep.id())); @@ -72,7 +74,9 @@ void irep_hash_container_baset::pack( const std::size_t non_comment_count = irept::number_of_non_comments(named_sub); - packed.reserve(1 + 1 + sub.size() + non_comment_count); + // we pack: the irep id, the sub size, the subs, the named-sub size, and + // each of the non-comment named subs with their ids + packed.reserve(1 + 1 + sub.size() + 1 + non_comment_count * 2); packed.push_back(irep_id_hash()(irep.id())); diff --git a/src/util/merge_irep.cpp b/src/util/merge_irep.cpp index db4df77d74e..7937adb29cf 100644 --- a/src/util/merge_irep.cpp +++ b/src/util/merge_irep.cpp @@ -44,9 +44,9 @@ bool to_be_merged_irept::operator == (const to_be_merged_irept &other) const const irept::named_subt &o_named_sub=other.get_named_sub(); if(sub.size()!=o_sub.size()) - return true; + return false; if(named_sub.size()!=o_named_sub.size()) - return true; + return false; { irept::subt::const_iterator s_it=sub.begin(); @@ -148,7 +148,7 @@ const irept &merge_irept::merged(const irept &irep) dest_named_sub[it->first]=merged(it->second); // recursive call #endif - return *irep_store.insert(new_irep).first; + return *irep_store.insert(std::move(new_irep)).first; } void merge_full_irept::operator()(irept &irep) @@ -185,5 +185,5 @@ const irept &merge_full_irept::merged(const irept &irep) dest_named_sub[it->first]=merged(it->second); // recursive call #endif - return *irep_store.insert(new_irep).first; + return *irep_store.insert(std::move(new_irep)).first; }