diff --git a/loopy/frontend/fortran/translator.py b/loopy/frontend/fortran/translator.py index f13f630985a750b3476d9c6e0521a190620c5bbe..e04e2cb78b96f8f6f000843b76a2291bf18b44a0 100644 --- a/loopy/frontend/fortran/translator.py +++ b/loopy/frontend/fortran/translator.py @@ -273,8 +273,13 @@ class FortranDivisionSpecializer(RuleAwareIdentityMapper): def map_fortran_division(self, expr, *args): # We remove all these before type inference ever sees them. - num_dtype = self.infer_type(expr.numerator).numpy_dtype - den_dtype = self.infer_type(expr.denominator).numpy_dtype + from loopy.type_inference import TypeInferenceFailure + + try: + num_dtype = self.infer_type(expr.numerator).numpy_dtype + den_dtype = self.infer_type(expr.denominator).numpy_dtype + except TypeInferenceFailure: + return super().map_fortran_division(expr, *args) from pymbolic.primitives import Quotient, FloorDiv if num_dtype.kind in "iub" and den_dtype.kind in "iub": diff --git a/loopy/type_inference.py b/loopy/type_inference.py index d168848dbd988921508fd05b718ad7e84d164d85..8b9b47f005fa829914039c00e6ce2b71395a1816 100644 --- a/loopy/type_inference.py +++ b/loopy/type_inference.py @@ -578,8 +578,7 @@ class TypeInferenceMapper(CombineMapper): def map_sub_array_ref(self, expr): return self.rec(expr.subscript) - def map_fortran_division(self, expr): - return [] + map_fortran_division = map_quotient # }}}