[PATCH] D15305: [CUDA] Do not allow dynamic initialization of global device side variables.

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 15 16:10:51 PST 2016


rsmith added inline comments.

================
Comment at: lib/CodeGen/CGDeclCXX.cpp:312
@@ +311,3 @@
+  // the checks have been done in Sema by now. Whatever initializers
+  // areallowed are empty and we just need to ignore them here.
+  if (getLangOpts().CUDA && getLangOpts().CUDAIsDevice &&
----------------
areallowed -> are allowed

================
Comment at: lib/CodeGen/CodeGenModule.cpp:2334
@@ -2339,1 +2333,3 @@
+      D->hasAttr<CUDASharedAttr>())
     Init = llvm::UndefValue::get(getTypes().ConvertType(ASTTy));
+  else if (!InitExpr) {
----------------
As this is a global variable, it should presumably still be statically zero-initialized.


http://reviews.llvm.org/D15305





More information about the cfe-commits mailing list