Another fix for early width and sign detection in ast simplifier
authorClifford Wolf <clifford@clifford.at>
Mon, 4 Nov 2013 20:29:36 +0000 (21:29 +0100)
committerClifford Wolf <clifford@clifford.at>
Mon, 4 Nov 2013 20:29:36 +0000 (21:29 +0100)
frontends/ast/simplify.cc

index 643855d081594c22825a5040c60ec1b959cba86e..81812a40fd9c53c7f66baff6ca00908fe43544a0 100644 (file)
@@ -191,8 +191,9 @@ bool AstNode::simplify(bool const_fold, bool at_zero, bool in_lvalue, int stage,
        case AST_ASSIGN:
                while (children[0]->simplify(false, false, true, stage, -1, false) == true) { }
                while (children[1]->simplify(false, false, false, stage, -1, false) == true) { }
-               children[0]->detectSignWidth(width_hint, backup_sign_hint);
-               children[1]->detectSignWidth(backup_width_hint, sign_hint);
+               children[0]->detectSignWidth(backup_width_hint, backup_sign_hint);
+               children[1]->detectSignWidth(width_hint, sign_hint);
+               width_hint = std::max(width_hint, backup_width_hint);
                child_0_is_self_determined = true;
                break;