Skip to content

Fix inline local declarations in assignment expressions#218

Open
OnlyYu1996 wants to merge 1 commit into
Syncleus:masterfrom
OnlyYu1996:fix-inline-assignment-declarations
Open

Fix inline local declarations in assignment expressions#218
OnlyYu1996 wants to merge 1 commit into
Syncleus:masterfrom
OnlyYu1996:fix-inline-assignment-declarations

Conversation

@OnlyYu1996
Copy link
Copy Markdown

Fixes #97.
Fixes #99.

This teaches the OpenCL writer to hoist local declarations that appear inside inline assignment expressions to the start of the current block. The original inline assignment expression is then emitted as a normal assignment, avoiding invalid OpenCL such as result = int assignMe = value and avoiding the previous CodeGenException for declarations in argument expressions.

The scan deliberately skips for-header and arbitrary-scope composites so existing scoped declarations keep their current output shape.

Validation:

  • mvn -q -Dstyle.color=never -Dtest=AssignAndPassAsParameterSimpleTest,FirstAssignInExpression2Test,AssignAndPassAsParameterTest,FirstAssignInExpressionTest test
  • mvn -q -Dstyle.color=never -Dtest=com.aparapi.codegen.test.*Test test
  • mvn -q -Dstyle.color=never -DskipTests test-compile
  • git diff --check

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] Two inline assignments in the same statement produce incorrect opencl code. [Bounty $20] Inline declarations throw exception.

1 participant