Fixed processing of initial values for block-local variables
authorClifford Wolf <clifford@clifford.at>
Fri, 11 Jul 2014 11:05:53 +0000 (13:05 +0200)
committerClifford Wolf <clifford@clifford.at>
Fri, 11 Jul 2014 11:05:53 +0000 (13:05 +0200)
frontends/ast/simplify.cc

index db7f5ca3448f68a71f236142975d11d5e1b2fd8b..e547ede36f85a7e1c8eced5fa7f2d4097589b682 100644 (file)
@@ -423,6 +423,11 @@ bool AstNode::simplify(bool const_fold, bool at_zero, bool in_lvalue, int stage,
                        if (did_something_here)
                                did_something = true;
                }
+               if (stage == 2 && children[i]->type == AST_INITIAL && current_ast_mod != this) {
+                       current_ast_mod->children.push_back(children[i]);
+                       children.erase(children.begin() + (i--));
+                       did_something = true;
+               }
        }
        for (auto &attr : attributes) {
                while (attr.second->simplify(true, false, false, stage, -1, false, true))