[PATCH] D59646: [PR40778][PR41157][OpenCL] Prevent implicit initialization of local address space objects
Alexey Bader via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Mar 24 13:40:30 PDT 2019
bader added inline comments.
================
Comment at: lib/Sema/SemaDecl.cpp:11648-11651
+ // In OpenCL we don't allow to initialize objects in local address space.
+ if (getLangOpts().OpenCL &&
+ Var->getType().getAddressSpace() == LangAS::opencl_local)
+ return;
----------------
Shouldn't we invalidate Var declaration?
================
Comment at: test/CodeGenOpenCLCXX/addrspace-of-this.cl:154
-// Test the address space of 'this' when invoking a constructor for an object in non-default address space
-// EXPL: call void @_ZNU3AS41CC1Ev(%class.C addrspace(4)* addrspacecast (%class.C addrspace(3)* @_ZZ11test__localvE1c to %class.C addrspace(4)*))
+// Test that we don't initialize an onbject in local address space
+// EXPL-NOT: call void @_ZNU3AS41CC1Ev(%class.C addrspace(4)* addrspacecast (%class.C addrspace(3)* @_ZZ11test__localvE1c to %class.C addrspace(4)*))
----------------
onbject -> object
================
Comment at: test/CodeGenOpenCLCXX/local_addrspace_init.cl:12
+ __local int i;
+ __local C ii;
+ //FIXME: In OpenCL C we don't accept initializers for local address space variables.
----------------
I guess this declaration should be disallowed for non-POD types. Can we add a check for that to some test/Sema* test?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D59646/new/
https://reviews.llvm.org/D59646
More information about the cfe-commits
mailing list