Bug fix for CAst translation. When translating if statements, the system has a case where code to detect dead blocks mistakenly triggers even though the needed CFG edge will be added later. The if processing code now tells the CFG that the block is not dead, which prevents it from being prematurely removed.
This commit is contained in:
parent
8d04766aa9
commit
46dddcfb66
|
@ -3809,7 +3809,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
|
|||
}
|
||||
|
||||
@Override
|
||||
protected boolean visitLabelStmt(CAstNode n, WalkContext c, CAstVisitor<WalkContext> visitor) {
|
||||
protected boolean visitLabelStmt(CAstNode n, WalkContext c, CAstVisitor<WalkContext> visitor) {
|
||||
WalkContext context = c;
|
||||
if (!context.getControlFlow().getSourceNodes(n).isEmpty()) {
|
||||
context.cfg().newBlock(true);
|
||||
|
@ -3849,6 +3849,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
|
|||
|
||||
falseB = context.cfg().getCurrentBlock();
|
||||
CAstNode f = n.getChild(2);
|
||||
context.cfg().deadBlocks.remove(falseB);
|
||||
visitor.visit(f, context, visitor);
|
||||
if (isExpr)
|
||||
context.cfg().addInstruction(new AssignInstruction(context.cfg().currentInstruction, c.getValue(n), c.getValue(f)));
|
||||
|
|
Loading…
Reference in New Issue