diff --git a/loopy/kernel/tools.py b/loopy/kernel/tools.py
index df0f3c931b46c32d0091a452855c27642a7bd269..8bdc72d54a91c6e8b4f9ec0ca3053831627d3eae 100644
--- a/loopy/kernel/tools.py
+++ b/loopy/kernel/tools.py
@@ -318,10 +318,16 @@ class SetOperationCacheManager:
         return result
 
     def dim_min(self, set, *args):
+        if set.plain_is_empty():
+            raise LoopyError("domain '%s' is empty" % set)
+
         from loopy.isl_helpers import dim_min_with_elimination
         return self.op(set, "dim_min", dim_min_with_elimination, args)
 
     def dim_max(self, set, *args):
+        if set.plain_is_empty():
+            raise LoopyError("domain '%s' is empty" % set)
+
         from loopy.isl_helpers import dim_max_with_elimination
         return self.op(set, "dim_max", dim_max_with_elimination, args)
 
diff --git a/loopy/library/reduction.py b/loopy/library/reduction.py
index 7037de99464858af858ea7c9d2e0c17c70311e7d..f9648bde7dc4d685ca9daf63ecf15b69496c8651 100644
--- a/loopy/library/reduction.py
+++ b/loopy/library/reduction.py
@@ -455,9 +455,9 @@ def parse_reduction_op(name):
 
 def reduction_function_mangler(kernel, func_id, arg_dtypes):
     if isinstance(func_id, ArgExtFunction) and func_id.name == "init":
-        from loopy.target.opencl import OpenCLTarget
-        if not isinstance(kernel.target, OpenCLTarget):
-            raise LoopyError("only OpenCL supported for now")
+        from loopy.target.opencl import CTarget
+        if not isinstance(kernel.target, CTarget):
+            raise LoopyError("%s: only C-like targets supported for now" % func_id)
 
         op = func_id.reduction_op
 
@@ -471,9 +471,9 @@ def reduction_function_mangler(kernel, func_id, arg_dtypes):
                 )
 
     elif isinstance(func_id, ArgExtFunction) and func_id.name == "update":
-        from loopy.target.opencl import OpenCLTarget
-        if not isinstance(kernel.target, OpenCLTarget):
-            raise LoopyError("only OpenCL supported for now")
+        from loopy.target.opencl import CTarget
+        if not isinstance(kernel.target, CTarget):
+            raise LoopyError("%s: only C-like targets supported for now" % func_id)
 
         op = func_id.reduction_op
 
@@ -491,9 +491,9 @@ def reduction_function_mangler(kernel, func_id, arg_dtypes):
                 )
 
     elif isinstance(func_id, SegmentedFunction) and func_id.name == "init":
-        from loopy.target.opencl import OpenCLTarget
-        if not isinstance(kernel.target, OpenCLTarget):
-            raise LoopyError("only OpenCL supported for now")
+        from loopy.target.opencl import CTarget
+        if not isinstance(kernel.target, CTarget):
+            raise LoopyError("%s: only C-like targets supported for now" % func_id)
 
         op = func_id.reduction_op
 
@@ -507,9 +507,9 @@ def reduction_function_mangler(kernel, func_id, arg_dtypes):
                 )
 
     elif isinstance(func_id, SegmentedFunction) and func_id.name == "update":
-        from loopy.target.opencl import OpenCLTarget
-        if not isinstance(kernel.target, OpenCLTarget):
-            raise LoopyError("only OpenCL supported for now")
+        from loopy.target.opencl import CTarget
+        if not isinstance(kernel.target, CTarget):
+            raise LoopyError("%s: only C-like targets supported for now" % func_id)
 
         op = func_id.reduction_op