Anastasia added a comment.
I agree there seems to be nothing specifically on this topic in OpenCL spec.
However, I wouldn't modify Clang and rely on its default behavior:
1. In C99 gives a warning
2. For some targets set up in a special way (i.e. SPIR) gives an error
================
Comment at: lib/Sema/SemaInit.cpp:6156
@@ +6155,3 @@
+ TyQualifiers.getAddressSpace() == LangAS::opencl_global;
+ if (!HasGlobalAS && Entity.getKind() == InitializedEntity::EK_Variable &&
+ Args.size() > 0) {
----------------
Actually I don't see any statement in spec that forbids initialization of
atomic variables inside the functions. It just says that ATOMIC_VAR_INIT can
only be used with global variables, but you are not checking that here.
http://reviews.llvm.org/D17438
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits