Skip to content

Fix inline local declaration assignments#224

Open
ksh368-bit wants to merge 1 commit into
Syncleus:masterfrom
ksh368-bit:fix-inline-local-declaration-assignment
Open

Fix inline local declaration assignments#224
ksh368-bit wants to merge 1 commit into
Syncleus:masterfrom
ksh368-bit:fix-inline-local-declaration-assignment

Conversation

@ksh368-bit
Copy link
Copy Markdown

Fixes #97.

This changes codegen so inline assignments that also introduce a local variable declaration are emitted with the local declaration hoisted before the statement. The inline expression itself then writes only the assignment, e.g. z=1, which avoids generating an invalid declaration in an argument expression.

Regression coverage updates AssignAndPassAsParameterSimpleTest from expecting CodeGenException to expecting generated OpenCL.

Verified with:

JAVA_HOME=/tmp/temurin8-x64/Contents/Home /opt/homebrew/bin/mvn -q -Dtest=com.aparapi.codegen.test.AssignAndPassAsParameterSimpleTest test
JAVA_HOME=/tmp/temurin8-x64/Contents/Home /opt/homebrew/bin/mvn -q -Dtest=com.aparapi.codegen.test.AssignAndPassAsParameterSimpleTest,com.aparapi.codegen.test.ConstantAssignInExpressionTest,com.aparapi.codegen.test.AssignAndPassAsParameterTest,com.aparapi.codegen.test.PostIncArrayItemAsParameterTest test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bounty $20] Inline declarations throw exception.

1 participant