[flang-commits] [clang] [flang] [llvm] [flang][flang-rt] Add -ffpe-trap= to set the initial FP exception halting mode (PR #208828)
Tarun Prabhu via flang-commits
flang-commits at lists.llvm.org
Wed Jul 22 07:33:03 PDT 2026
================
@@ -327,6 +326,33 @@ defm real_sum_reassociation
standard-conforming Fortran semantics.
}]>;
+def ffpe_trap_EQ : Joined<["-"], "ffpe-trap=">, Group<f_Group>,
+ HelpText<"Set the initial floating-point exception halting mode for the main program">,
+ DocBrief<[{The ``-ffpe-trap=[list]`` option sets the initial floating-point
+exception halting mode for the main program unit. ``[list]`` is a comma-separated
+list of the exceptions to halt on: ``invalid``, ``zero``, ``overflow``,
+``underflow``, and ``inexact``, corresponding to the Fortran 2023 (17.6)
+``IEEE_FLAG_TYPE`` values ``IEEE_INVALID``, ``IEEE_DIVIDE_BY_ZERO``,
+``IEEE_OVERFLOW``, ``IEEE_UNDERFLOW``, and ``IEEE_INEXACT``. As a non-standard
+GFortran-compatible extension, ``denormal`` halts on the hardware denormal
+(subnormal) operand exception. An empty list, or the value ``none``, disables
+halting. In the absence of this option, the program runs with traps disabled
+(equivalent to passing ``none``). Multiple occurrences are allowed; only the
+last ``-ffpe-trap=`` takes effect.
+
+Halting is enabled only for exceptions the target's floating-point environment
+can trap on. Halting control is implemented for x86 targets and for glibc-based
+(Linux) targets; for other targets the compiler emits a warning that the option
----------------
tarunprabhu wrote:
I am a little confused by the text in this paragraph and the next. Is this saying that halting control is available on x86 regardless of the libc implementation, and, on non-x86 targets, it is supported *only* if the underlying libc implementation is glibc?
https://github.com/llvm/llvm-project/pull/208828
More information about the flang-commits
mailing list