From e1f2b487cea9245ebc6ed48678019b673741c1ea Mon Sep 17 00:00:00 2001
From: Andreas Kloeckner <inform@tiker.net>
Date: Mon, 8 Apr 2013 11:08:13 -0400
Subject: [PATCH] Catch 'empty scan' corner case.

---
 pyopencl/scan.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/pyopencl/scan.py b/pyopencl/scan.py
index 9692233d..d0781b31 100644
--- a/pyopencl/scan.py
+++ b/pyopencl/scan.py
@@ -1272,6 +1272,10 @@ class GenericScanKernel(_GenericScanKernelBase):
         if n is None:
             n, = first_array.shape
 
+        if n == 0:
+            # We're done here.
+            return
+
         data_args = []
         from pyopencl.tools import VectorArg
         for arg_descr, arg_val in zip(self.parsed_args, args):
-- 
GitLab