r303846 - [OpenCL] reserve_id_t cannot be used as argument to kernel function

Egor Churaev via cfe-commits cfe-commits at lists.llvm.org
Thu May 25 00:18:37 PDT 2017

Author: echuraev
Date: Thu May 25 02:18:37 2017
New Revision: 303846

URL: http://llvm.org/viewvc/llvm-project?rev=303846&view=rev
[OpenCL] reserve_id_t cannot be used as argument to kernel function

Reviewers: Anastasia

Reviewed By: Anastasia

Subscribers: yaxunl, cfe-commits, bader

Differential Revision: https://reviews.llvm.org/D33483


Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=303846&r1=303845&r2=303846&view=diff
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Thu May 25 02:18:37 2017
@@ -7920,10 +7920,7 @@ static OpenCLParamType getOpenCLKernelPa
   if (PT->isImageType())
     return PtrKernelParam;
-  if (PT->isBooleanType())
-    return InvalidKernelParam;
-  if (PT->isEventT())
+  if (PT->isBooleanType() || PT->isEventT() || PT->isReserveIDT())
     return InvalidKernelParam;
   // OpenCL extension spec v1.2 s9.5:

Modified: cfe/trunk/test/SemaOpenCL/invalid-pipes-cl2.0.cl
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaOpenCL/invalid-pipes-cl2.0.cl?rev=303846&r1=303845&r2=303846&view=diff
--- cfe/trunk/test/SemaOpenCL/invalid-pipes-cl2.0.cl (original)
+++ cfe/trunk/test/SemaOpenCL/invalid-pipes-cl2.0.cl Thu May 25 02:18:37 2017
@@ -3,6 +3,11 @@
 global pipe int gp;            // expected-error {{type '__global read_only pipe int' can only be used as a function parameter in OpenCL}}
 global reserve_id_t rid;          // expected-error {{the '__global reserve_id_t' type cannot be used to declare a program scope variable}}
+extern pipe write_only int get_pipe(); // expected-error {{type '__global write_only pipe int ()' can only be used as a function parameter in OpenCL}}
+kernel void test_invalid_reserved_id(reserve_id_t ID) { // expected-error {{'reserve_id_t' cannot be used as the type of a kernel parameter}}
 void test1(pipe int *p) {// expected-error {{pipes packet types cannot be of reference type}}
 void test2(pipe p) {// expected-error {{missing actual type specifier for pipe}}

More information about the cfe-commits mailing list