File tree Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Original file line number Diff line number Diff line change 1313#include < cfenv>
1414#if defined(__aarch64__) && !defined(_WIN32)
1515#include < fpu_control.h>
16- #elif defined(__x86_64__)
16+ #elif defined(__x86_64__) && !defined(_WIN32)
1717#include < xmmintrin.h>
1818#endif
1919
20- // fenv.h may not define exception macros.
20+ // File fenv.h usually, but not always, defines standard exceptions as both
21+ // enumerator values and preprocessor #defines. Some x86 environments also
22+ // define a nonstandard __FE_DENORM enumerator, but without a corresponding
23+ // #define, which makes it more difficult to determine if it is present or not.
2124#ifndef FE_INVALID
2225#define FE_INVALID 0
2326#endif
3336#ifndef FE_INEXACT
3437#define FE_INEXACT 0
3538#endif
39+ #if FE_INVALID == 1 && FE_DIVBYZERO == 4 && FE_OVERFLOW == 8 && \
40+ FE_UNDERFLOW == 16 && FE_INEXACT == 32
41+ #define __FE_DENORM 2
42+ #else
43+ #define __FE_DENORM 0
44+ #endif
3645
3746namespace Fortran ::runtime {
3847
@@ -44,11 +53,7 @@ uint32_t RTNAME(MapException)(uint32_t excepts) {
4453 Terminator terminator{__FILE__, __LINE__};
4554
4655 static constexpr uint32_t v{FE_INVALID};
47- #if __x86_64__
48- static constexpr uint32_t s{__FE_DENORM}; // nonstandard, not a #define
49- #else
50- static constexpr uint32_t s{0 };
51- #endif
56+ static constexpr uint32_t s{__FE_DENORM};
5257 static constexpr uint32_t z{FE_DIVBYZERO};
5358 static constexpr uint32_t o{FE_OVERFLOW};
5459 static constexpr uint32_t u{FE_UNDERFLOW};
You can’t perform that action at this time.
0 commit comments