diff --git a/loopy/target/pyopencl.py b/loopy/target/pyopencl.py
index 9955705a2fbca26d12dad95b45d2f547ad778568..744c03d8ed091bc0f05e4fc41aa14e88ec89276a 100644
--- a/loopy/target/pyopencl.py
+++ b/loopy/target/pyopencl.py
@@ -61,6 +61,11 @@ def adjust_local_temp_var_storage(kernel, device):
                     temp_var.copy(storage_shape=temp_var.shape)
             continue
 
+        if not temp_var.shape:
+            # scalar, no need to mess with storage shape
+            new_temp_vars[temp_var.name] = temp_var
+            continue
+
         other_loctemp_nbytes = [
                 tv.nbytes
                 for tv in six.itervalues(kernel.temporary_variables)