From 6c21ed6b920d34ea7035f42be51c3a1834160d0d Mon Sep 17 00:00:00 2001 From: Michael Tautschnig Date: Wed, 15 Nov 2023 16:05:19 +0000 Subject: [PATCH] irep serialisation: do not use string hash We want string numbering, not string hashing. For `dstringt` these are interchangeable, but that's not the case for `std::string`. --- src/util/irep_serialization.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/util/irep_serialization.cpp b/src/util/irep_serialization.cpp index b9a6d68345d7..e959e8d99f1d 100644 --- a/src/util/irep_serialization.cpp +++ b/src/util/irep_serialization.cpp @@ -13,11 +13,12 @@ Date: May 2007 #include "irep_serialization.h" +#include "exception_utils.h" +#include "string_container.h" + #include #include -#include "exception_utils.h" - void irep_serializationt::write_irep( std::ostream &out, const irept &irep) @@ -211,7 +212,11 @@ void irep_serializationt::write_string_ref( std::ostream &out, const irep_idt &s) { - size_t id=irep_id_hash()(s); +#ifdef USE_DSTRING + size_t id = s.get_no(); +#else + size_t id = get_string_container()[s]; +#endif if(id>=ireps_container.string_map.size()) ireps_container.string_map.resize(id+1, false);