Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Zero-initialize struct to avoid valgrind warnings.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Thu, 1 Apr 2021 20:22:15 +0000 (22:22 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Thu, 1 Apr 2021 21:08:39 +0000 (23:08 +0200)
Use memset, since there is no warranty that the padding bits are set to zero
with an empty initilizer-list {}

src/mc/ModelChecker.cpp
src/mc/Session.cpp

index a4feac6..3a9fb85 100644 (file)
@@ -383,7 +383,10 @@ std::string ModelChecker::simcall_dot_label(int aid, int times_considered)
 
 void ModelChecker::finalize_app(bool terminate_asap)
 {
-  s_mc_message_int_t m{MessageType::FINALIZE, terminate_asap};
+  s_mc_message_int_t m;
+  memset(&m, 0, sizeof m);
+  m.type  = MessageType::FINALIZE;
+  m.value = terminate_asap;
   int res = checker_side_.get_channel().send(m);
   xbt_assert(res == 0, "Could not ask the app to finalize on need");
 
index 1eaae21..5a22cbb 100644 (file)
@@ -146,7 +146,8 @@ void Session::close()
 
 bool Session::actor_is_enabled(aid_t pid) const
 {
-  s_mc_message_actor_enabled_t msg{};
+  s_mc_message_actor_enabled_t msg;
+  memset(&msg, 0, sizeof msg);
   msg.type = simgrid::mc::MessageType::ACTOR_ENABLED;
   msg.aid  = pid;
   model_checker_->channel().send(msg);