From 0f7c6733f7f18354289825160c181ff46dd76366 Mon Sep 17 00:00:00 2001 From: jespergravgaard Date: Tue, 23 Jun 2020 00:42:14 +0200 Subject: [PATCH] Fixed problem where functions without body produced an empty block. --- .../camelot64/kickc/passes/Pass1GenerateControlFlowGraph.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/dk/camelot64/kickc/passes/Pass1GenerateControlFlowGraph.java b/src/main/java/dk/camelot64/kickc/passes/Pass1GenerateControlFlowGraph.java index ec2b098be..2090505d5 100644 --- a/src/main/java/dk/camelot64/kickc/passes/Pass1GenerateControlFlowGraph.java +++ b/src/main/java/dk/camelot64/kickc/passes/Pass1GenerateControlFlowGraph.java @@ -31,6 +31,9 @@ public class Pass1GenerateControlFlowGraph extends Pass1Base { for(Procedure procedure : allProcedures) { final ProcedureCompilation procedureCompilation = getProgram().getProcedureCompilation(procedure.getRef()); final StatementSequence sequence = procedureCompilation.getStatementSequence(); + if(sequence.getStatements().size()==0) + // Empry procedures should not produce any blocks + continue; ControlFlowBlock currentBlock = null; ControlFlowBlock procBlock = getOrCreateBlock(procedure.getLabel().getRef(), procedure.getRef()); currentBlock = procBlock;