This PR fixes a bug of concurrent modification to Map in the util helper RemoveUnusedVars.
Prior to this PR, the Map users will be modified when a Map iteration going on, which will raise error in certain optimization level and debug level configured in CMake. This PR fixes the bug by collecting the map keys in ahead of the modification.
This bug is already covered by current tests we have for binding rewrite. We should be mindful of possible concurrent modification issue in the future development.
This PR fixes a bug of concurrent modification to Map in the util helper RemoveUnusedVars.
Prior to this PR, the Map
users
will be modified when a Map iteration going on, which will raise error in certain optimization level and debug level configured in CMake. This PR fixes the bug by collecting the map keys in ahead of the modification.This bug is already covered by current tests we have for binding rewrite. We should be mindful of possible concurrent modification issue in the future development.
Co-authored-by: Chaofan Lin siriusneo@sjtu.edu.cn