summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/passes/GlobalStructInference.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/passes/GlobalStructInference.cpp b/src/passes/GlobalStructInference.cpp
index 901a51a9f..89ab155f8 100644
--- a/src/passes/GlobalStructInference.cpp
+++ b/src/passes/GlobalStructInference.cpp
@@ -157,7 +157,9 @@ struct GlobalStructInference : public Pass {
// unoptimizable type makes all its supertypes unoptimizable as well.
// TODO: this could be specific per field (and not all supers have all
// fields)
- for (auto type : unoptimizable) {
+ // Iterate on a copy to avoid invalidation as we insert.
+ auto unoptimizableCopy = unoptimizable;
+ for (auto type : unoptimizableCopy) {
while (1) {
unoptimizable.insert(type);