[flang][runtime] Emit error message rather than crashing for MOD(ULO)(x,P=0)
authorPeter Klausler <pklausler@nvidia.com>
Thu, 2 Jun 2022 21:06:57 +0000 (14:06 -0700)
committerPeter Klausler <pklausler@nvidia.com>
Sat, 4 Jun 2022 18:02:48 +0000 (11:02 -0700)
commit562fd2c99b70691affe7776a1900e95ee7da0b3b
treea2cb3498d56f0ea4e2700b38212a06cb93240929
parent11f928af9bfaefc0965a43f5ad6d480ded3de4a5
[flang][runtime] Emit error message rather than crashing for MOD(ULO)(x,P=0)

Add extra arguments and checks to the runtime support library so that
a call to the intrinsic functions MOD and MODULO with "denominator"
argument P of zero will cause a crash with a source location rather
than an uninformative floating-point error or integer division by
zero signal.

Additional work is required in lowering to (1) pass source file path and
source line number arguments and (2) actually call these runtime
library APIs instead of emitting inline code for MOD &/or MODULO.

Differential Revision: https://reviews.llvm.org/D127034
flang/include/flang/Runtime/numeric.h
flang/runtime/numeric.cpp