diff --git a/loopy/symbolic.py b/loopy/symbolic.py index 054ed878171bd815676cc0ff45617b156f6f06e5..725fbad3be4a6e77c990a987f299fe29c9fff2b6 100644 --- a/loopy/symbolic.py +++ b/loopy/symbolic.py @@ -109,8 +109,11 @@ class FunctionToPrimitiveMapper(IdentityMapper): raise TypeError("invalid 'reduce' calling sequence") else: from loopy.kernel import parse_reduction_op - if (parse_reduction_op(expr.function.name) - and len(expr.parameters) == 2): + if parse_reduction_op(expr.function.name): + if len(expr.parameters) != 2: + raise RuntimeError("invalid invocation of " + "reduction operation '%s'" % expr.function.name) + operation = expr.function inames, red_expr = expr.parameters else: