design: do not delete when iterating over Design::modules() directly
authorEddie Hung <eddie@fpgeh.com>
Tue, 14 Apr 2020 17:43:05 +0000 (10:43 -0700)
committerEddie Hung <eddie@fpgeh.com>
Tue, 14 Apr 2020 17:43:05 +0000 (10:43 -0700)
passes/cmds/design.cc

index 4612760cc9d3528e02365447e4d7d7576caf5722..8861182aa7a503700712e71ddceda4d6103454e4 100644 (file)
@@ -340,7 +340,7 @@ struct DesignPass : public Pass {
 
                if (reset_mode || !load_name.empty() || push_mode || pop_mode)
                {
-                       for (auto mod : design->modules())
+                       for (auto mod : design->modules().to_vector())
                                design->remove(mod);
 
                        design->selection_stack.clear();