Index: include/clang/Basic/DiagnosticSemaKinds.td
===================================================================
--- include/clang/Basic/DiagnosticSemaKinds.td	(revision 158365)
+++ include/clang/Basic/DiagnosticSemaKinds.td	(working copy)
@@ -5587,6 +5587,10 @@
 // OpenCL warnings and errors.
 def err_invalid_astype_of_different_size : Error<
   "invalid reinterpretation: sizes of %0 and %1 must match">;
+def err_static_kernel : Error<
+  "kernel functions cannot be declared static">;
+def err_static_local_scope : Error<
+  "variables in local scope cannot be declared static">;
 
 } // end of sema category
 
Index: lib/Sema/SemaDecl.cpp
===================================================================
--- lib/Sema/SemaDecl.cpp	(revision 158365)
+++ lib/Sema/SemaDecl.cpp	(working copy)
@@ -4418,6 +4418,16 @@
     return false;
   }
 
+  // OpenCL: Sec 6.8 -- The static qualifier is valid only in program
+  // scope.
+  if (getLangOpts().OpenCL) {
+    if (NewVD->isStaticLocal()) {
+      Diag(NewVD->getLocation(), diag::err_static_local_scope);
+      NewVD->setInvalidDecl();
+      return false;
+    }
+  }
+
   if (NewVD->hasLocalStorage() && T.isObjCGCWeak()
       && !NewVD->hasAttr<BlocksAttr>()) {
     if (getLangOpts().getGC() != LangOptions::NonGC)
@@ -5737,6 +5747,15 @@
     }
   }
 
+  if (getLangOpts().OpenCL) {
+    if (NewFD->hasAttr<OpenCLKernelAttr>())
+      // OpenCL: 6.8 static is invalid for kernel functions.
+        if (SC == SC_Static) {
+          Diag(D.getIdentifierLoc(), diag::err_static_kernel);
+          D.setInvalidType();
+        }
+  }
+
   MarkUnusedFileScopedDecl(NewFD);
 
   if (getLangOpts().CUDA)
Index: lib/Sema/DeclSpec.cpp
===================================================================
--- lib/Sema/DeclSpec.cpp	(revision 158365)
+++ lib/Sema/DeclSpec.cpp	(working copy)
@@ -420,7 +420,7 @@
 bool DeclSpec::SetStorageClassSpec(Sema &S, SCS SC, SourceLocation Loc,
                                    const char *&PrevSpec,
                                    unsigned &DiagID) {
-  // OpenCL 1.1 6.8g: "The extern, static, auto and register storage-class
+  // OpenCL 1.2 6.8: "The auto and register storage-class
   // specifiers are not supported."
   // It seems sensible to prohibit private_extern too
   // The cl_clang_storage_class_specifiers extension enables support for
@@ -428,11 +428,8 @@
   if (S.getLangOpts().OpenCL &&
       !S.getOpenCLOptions().cl_clang_storage_class_specifiers) {
     switch (SC) {
-    case SCS_extern:
-    case SCS_private_extern:
     case SCS_auto:
     case SCS_register:
-    case SCS_static:
       DiagID   = diag::err_not_opencl_storage_class_specifier;
       PrevSpec = getSpecifierName(SC);
       return true;
