[PATCH] D42844: [OpenCL] Add test for atomic pointers.

Mariya Podchishchaeva via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 2 07:22:34 PST 2018


Fznamznon created this revision.
Herald added subscribers: cfe-commits, Anastasia, yaxunl.

Repository:
  rC Clang

https://reviews.llvm.org/D42844

Files:
  test/SemaOpenCL/atomic-ptr.cl


Index: test/SemaOpenCL/atomic-ptr.cl
===================================================================
--- /dev/null
+++ test/SemaOpenCL/atomic-ptr.cl
@@ -0,0 +1,17 @@
+// RUN: %clang_cc1 -O0 -cl-std=CL2.0 -fsyntax-only -verify %s
+// expected-no-diagnostics
+
+void __kernel test_atomic_ptrs(void){
+  // Null assignment to atomic pointer is legal
+  local atomic_int *p1 = 0;
+
+  // Array aliasing is permitted
+  local atomic_int a[16];
+  local atomic_int *p2 = a;
+
+  // Test pointer arithmetics
+  local atomic_int *p3 = p1 + 1;
+
+  // Test implicit cast to pointer
+  local atomic_int *p4 = a + 1;
+}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42844.132583.patch
Type: text/x-patch
Size: 613 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180202/dd6a377c/attachment.bin>


More information about the cfe-commits mailing list