From aa19eba7f977abf53271786a50899a5362319f91 Mon Sep 17 00:00:00 2001
From: Andreas Kloeckner <inform@tiker.net>
Date: Thu, 6 Dec 2018 13:24:13 -0600
Subject: [PATCH] Minor fixes to scan

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

diff --git a/pyopencl/scan.py b/pyopencl/scan.py
index cef68c67..30a657d8 100644
--- a/pyopencl/scan.py
+++ b/pyopencl/scan.py
@@ -330,16 +330,17 @@ void ${kernel_name}(
                 const index_type offset_end = interval_end - unit_base;
             %endif
 
-            for(index_type k = 1; k < K; k++)
+            for (index_type k = 1; k < K; k++)
             {
                 %if is_tail:
-                if (K * LID_0 + k < offset_end)
+                if ((index_type) (K * LID_0 + k) < offset_end)
                 %endif
                 {
                     scan_type tmp = ldata[k][LID_0].value;
-                    index_type seq_i = unit_base + K*LID_0 + k;
 
                     %if is_segmented:
+                    index_type seq_i = unit_base + K*LID_0 + k;
+
                     if (l_segment_start_flags[k][LID_0])
                     {
                         first_segment_start_in_k_group = min(
-- 
GitLab