From 07ab2621dc6e24db97f7e0130a5c5b6abfb2f7c1 Mon Sep 17 00:00:00 2001
From: Alexandru Fikl <alexfikl@gmail.com>
Date: Wed, 6 Oct 2021 19:04:43 -0500
Subject: [PATCH] fix strides for 0-sized c-contiguous arrays

---
 pyopencl/array.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/pyopencl/array.py b/pyopencl/array.py
index d48eece6..a991b237 100644
--- a/pyopencl/array.py
+++ b/pyopencl/array.py
@@ -530,7 +530,8 @@ class Array:
                     if shape:
                         strides = [dtype.itemsize]
                         for s in shape[:0:-1]:
-                            strides.append(strides[-1]*s)
+                            # NOTE: https://github.com/inducer/compyte/pull/36
+                            strides.append(strides[-1]*_builtin_max(1, s))
                         strides = tuple(strides[::-1])
                     else:
                         strides = ()
-- 
GitLab