-
Notifications
You must be signed in to change notification settings - Fork 12.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[OpenCL] compile clang block crash #53436
Comments
@llvm/issue-subscribers-opencl |
@llvm/issue-subscribers-clang-codegen |
The blocks functionality has been fixed in https://reviews.llvm.org/rGa5de66c4c50b5dec085ffbcd2afefd47f3f18d7f. But it is unlikely you will be able to use |
The issue still exists with latest clang. |
FYI the source appears to be invalid however regardless compiler should not fail. if I replace line 12 with
which I think is close to the original intent of this example? I am getting the diagnostics:
Because nested blocks seem to be disallowed. See in Compiler Explorer: https://godbolt.org/z/xoePrEMeh. |
@AnastasiaStulova To clarify the original intent, I was trying to dynamically create a reference (as in C++ referenc) to the block in
Where I then use the dynamically resolved Now that I see your comment about this not being allowed in OpenCL I have re-read the docs and https://www.khronos.org/registry/OpenCL/sdk/2.0/docs/man/xhtml/blocks.html seems to confirm your statement. Seems I have to rewrite this piece as switch statement. This being invalid probably also explains why I had such problems getting this to run on other OpenCL implementations. Still no idea why it works on the AMD OpenCL compiler though. Nevertheless, I shouldn't be able to crash the compiler even with my invalid code and it should produce the correct error message. |
Dynamically assigning a block reference using the ?: operator is not allowed according to: https://www.khronos.org/registry/OpenCL/specs/2.2/ html/OpenCL_C.html#restrictions-1 This buggy code made compilers crash in bad ways, see: https:// github.com/llvm/llvm-project/issues/53436
The linked commit now fixes the code to not violate the OpenCL block rules. Can anyone confirm it's valid OpenCL C? |
Ok, this seems to make sense since you are now using the exact block statically. |
block.cl.txt
The text was updated successfully, but these errors were encountered: