1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-10-04 20:55:00 +00:00

Removed extra assignment for return value

This commit is contained in:
jespergravgaard 2019-09-17 09:11:46 +02:00
parent 95f97d842a
commit e83e44675a
2 changed files with 3 additions and 3 deletions

View File

@ -213,7 +213,7 @@ public class Pass0GenerateStatementSequence extends KickCParserBaseVisitor<Objec
this.visit(ctx.stmtSeq());
}
sequence.addStatement(new StatementLabel(procExit.getRef(), StatementSource.procedureEnd(ctx), Comment.NO_COMMENTS));
if(returnVar != null) {
if(Procedure.CallingConvension.PHI_CALL.equals(procedure.getCallingConvension()) && returnVar != null) {
sequence.addStatement(new StatementAssignment(returnVar.getRef(), returnVar.getRef(), StatementSource.procedureEnd(ctx), Comment.NO_COMMENTS));
}
VariableRef returnVarRef = null;

View File

@ -40,12 +40,12 @@ public class TestPrograms {
public void testProcedureCallingConventionStack1() throws IOException, URISyntaxException {
compileAndCompare("procedure-callingconvention-stack-1", log());
}
*/
@Test
public void testProcedureCallingConventionStack0() throws IOException, URISyntaxException {
compileAndCompare("procedure-callingconvention-stack-0", log());
compileAndCompare("procedure-callingconvention-stack-0", log().verboseCreateSsa().verboseParse().verboseStatementSequence());
}
*/
@Test
public void testStringPointerProblem() throws IOException, URISyntaxException {