================ @@ -0,0 +1,31 @@ +! Test that -ffpe-trap= generates a call to _FortranAEnableFPETraps in main(). + +! RUN: %flang_fc1 -emit-fir -ffpe-trap=invalid %s -o - | FileCheck --check-prefix=CHECK-INVALID %s +! RUN: %flang_fc1 -emit-fir -ffpe-trap=invalid,zero,overflow %s -o - | FileCheck --check-prefix=CHECK-MULTI %s +! RUN: %flang_fc1 -emit-fir -ffpe-trap=invalid,underflow,inexact,denormal %s -o - | FileCheck --check-prefix=CHECK-EXT %s +! RUN: %flang_fc1 -emit-fir %s -o - | FileCheck --check-prefix=CHECK-NONE %s +! RUN: %flang_fc1 -emit-fir -ffpe-trap=none %s -o - | FileCheck --check-prefix=CHECK-NONE %s +! RUN: %flang_fc1 -emit-fir -ffpe-trap=invalid,none %s -o - | FileCheck --check-prefix=CHECK-NONE %s + +program test + continue +end + +! CHECK-INVALID: %[[TRAPS:.*]] = arith.constant 1 : i32 +! CHECK-INVALID: fir.call @_FortranAProgramStart( +! CHECK-INVALID: fir.call @_FortranAEnableFPETraps(%[[TRAPS]]) +! CHECK-INVALID: fir.call @_QQmain + +! invalid=1, zero=4, overflow=8 => 13 +! CHECK-MULTI: %[[TRAPS:.*]] = arith.constant 13 : i32 ---------------- tarunprabhu wrote:
nit: Is there precedence for reusing the same name like this? If there is, it's fine. I just find it easier if distinct names are used. Perhaps it could be named to match the label, so `MULTI` in this case? https://github.com/llvm/llvm-project/pull/208828 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
