fsm_opt: Fix runtime error for FSMs without a reset state
authorDavid Shah <dave@ds0.me>
Thu, 7 Feb 2019 10:35:36 +0000 (10:35 +0000)
committerDavid Shah <dave@ds0.me>
Thu, 7 Feb 2019 10:35:36 +0000 (10:35 +0000)
Signed-off-by: David Shah <dave@ds0.me>
passes/fsm/fsm_opt.cc

index 3a6ac274607fa71d7df1f74787ffbeddb6a11d03..048daee55f5c3ec81f7819211c73c324b80d9ab1 100644 (file)
@@ -72,7 +72,8 @@ struct FsmOpt
 
                        new_transition_table.swap(fsm_data.transition_table);
                        new_state_table.swap(fsm_data.state_table);
-                       fsm_data.reset_state = old_to_new_state.at(fsm_data.reset_state);
+                       if (fsm_data.reset_state != -1)
+                               fsm_data.reset_state = old_to_new_state.at(fsm_data.reset_state);
                }
        }