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 13
13
#include < cfenv>
14
14
#if defined(__aarch64__) && !defined(_WIN32)
15
15
#include < fpu_control.h>
16
- #elif defined(__x86_64__)
16
+ #elif defined(__x86_64__) && !defined(_WIN32)
17
17
#include < xmmintrin.h>
18
18
#endif
19
19
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.
21
24
#ifndef FE_INVALID
22
25
#define FE_INVALID 0
23
26
#endif
33
36
#ifndef FE_INEXACT
34
37
#define FE_INEXACT 0
35
38
#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
36
45
37
46
namespace Fortran ::runtime {
38
47
@@ -44,11 +53,7 @@ uint32_t RTNAME(MapException)(uint32_t excepts) {
44
53
Terminator terminator{__FILE__, __LINE__};
45
54
46
55
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};
52
57
static constexpr uint32_t z{FE_DIVBYZERO};
53
58
static constexpr uint32_t o{FE_OVERFLOW};
54
59
static constexpr uint32_t u{FE_UNDERFLOW};
You can’t perform that action at this time.
0 commit comments