Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Initialize uninitialized transition for root state
authorMaxwell Pirtle <maxwellpirtle@gmail.com>
Thu, 16 Feb 2023 14:51:37 +0000 (15:51 +0100)
committerMaxwell Pirtle <maxwellpirtle@gmail.com>
Thu, 16 Feb 2023 14:51:37 +0000 (15:51 +0100)
The transition in the root state was uninitialized
and this appears to have caused the last of the remaining
issues with the test suite. Of course, reading from the
uninitialized pointer `transition_` is bound to cause
a bunch of problems...

src/mc/api/State.cpp
src/mc/api/State.hpp

index 1cdc87e..e6a1659 100644 (file)
@@ -18,6 +18,8 @@ State::State(const RemoteApp& remote_app) : default_transition(std::make_unique<
 {
   remote_app.get_actors_status(actors_to_run_);
 
+  transition_ = default_transition.get();
+
   /* Stateful model checking */
   if ((_sg_mc_checkpoint > 0 && (num_ % _sg_mc_checkpoint == 0)) || _sg_mc_termination) {
     system_state_ = std::make_shared<simgrid::mc::Snapshot>(num_);
index f3fe4b2..c36eddc 100644 (file)
@@ -25,7 +25,7 @@ class XBT_PRIVATE State : public xbt::Extendable<State> {
    * or a reference to the internal default transition `Transition()` if no transition has been
    * set
    */
-  Transition* transition_;
+  Transition* transition_ = nullptr;
 
   /**
    * @brief An empty transition that leads to this state by default