File tree Expand file tree Collapse file tree 5 files changed +23
-32
lines changed Expand file tree Collapse file tree 5 files changed +23
-32
lines changed Original file line number Diff line number Diff line change @@ -115,6 +115,21 @@ class Terminator {
115
115
RT_API_ATTRS void NotifyOtherImagesOfNormalEnd ();
116
116
RT_API_ATTRS void NotifyOtherImagesOfFailImageStatement ();
117
117
RT_API_ATTRS void NotifyOtherImagesOfErrorTermination ();
118
+
119
+ #if defined(RT_DEVICE_COMPILATION)
120
+ // / Trap the execution on the device.
121
+ [[noreturn]] void RT_API_ATTRS DeviceTrap () {
122
+ #if defined(__CUDACC__)
123
+ // NVCC supports __trap().
124
+ __trap ();
125
+ #elif defined(__clang__)
126
+ // Clang supports __builtin_trap().
127
+ __builtin_trap ();
128
+ #else
129
+ #error "unsupported compiler"
130
+ #endif
131
+ }
132
+ #endif
118
133
} // namespace Fortran::runtime
119
134
120
135
namespace Fortran ::runtime::io {
Original file line number Diff line number Diff line change 23
23
24
24
extern " C" {
25
25
26
- static void DescribeIEEESignaledExceptions () {
26
+ [[maybe_unused]] static void DescribeIEEESignaledExceptions () {
27
27
#ifdef fetestexcept // a macro in some environments; omit std::
28
28
auto excepts{fetestexcept (FE_ALL_EXCEPT)};
29
29
#else
@@ -82,15 +82,7 @@ static void CloseAllExternalUnits(const char *why) {
82
82
}
83
83
std::printf (" \n " );
84
84
}
85
- #if defined(__CUDACC__)
86
- // NVCC supports __trap().
87
- __trap ();
88
- #elif defined(__clang__)
89
- // Clang supports __builtin_trap().
90
- __builtin_trap ();
91
- #else
92
- #error "unsupported compiler"
93
- #endif
85
+ Fortran::runtime::DeviceTrap ();
94
86
#else
95
87
CloseAllExternalUnits (" STOP statement" );
96
88
if (Fortran::runtime::executionEnvironment.noStopMessage && code == 0 ) {
@@ -119,17 +111,7 @@ static void CloseAllExternalUnits(const char *why) {
119
111
" Fortran %s: %s\n " , isErrorStop ? " ERROR STOP" : " STOP" , code);
120
112
}
121
113
}
122
- if (isErrorStop) {
123
- #if defined(__CUDACC__)
124
- // NVCC supports __trap().
125
- __trap ();
126
- #elif defined(__clang__)
127
- // Clang supports __builtin_trap().
128
- __builtin_trap ();
129
- #else
130
- #error "unsupported compiler"
131
- #endif
132
- }
114
+ Fortran::runtime::DeviceTrap ();
133
115
#else
134
116
CloseAllExternalUnits (" STOP statement" );
135
117
if (!quiet) {
Original file line number Diff line number Diff line change @@ -75,15 +75,7 @@ RT_API_ATTRS void Terminator::CrashHeader() const {
75
75
#endif
76
76
NotifyOtherImagesOfErrorTermination ();
77
77
#if defined(RT_DEVICE_COMPILATION)
78
- #if defined(__CUDACC__)
79
- // NVCC supports __trap().
80
- __trap ();
81
- #elif defined(__clang__)
82
- // Clang supports __builtin_trap().
83
- __builtin_trap ();
84
- #else
85
- #error "unsupported compiler"
86
- #endif
78
+ DeviceTrap ();
87
79
#else
88
80
std::abort ();
89
81
#endif
Original file line number Diff line number Diff line change 17
17
#ifndef FORTRAN_COMMON_ENUM_CLASS_H_
18
18
#define FORTRAN_COMMON_ENUM_CLASS_H_
19
19
20
- #include " flang/Common/variant.h"
21
20
#include < array>
22
21
#include < string>
23
22
Original file line number Diff line number Diff line change 16
16
17
17
#include " flang/Common/api-attrs.h"
18
18
19
- #if RT_USE_LIBCUDACXX && defined(RT_DEVICE_COMPILATION)
19
+ #if RT_USE_LIBCUDACXX
20
20
#include < cuda/std/complex>
21
+ #endif
22
+
23
+ #if RT_USE_LIBCUDACXX && defined(RT_DEVICE_COMPILATION)
21
24
namespace Fortran ::runtime::rtcmplx {
22
25
using cuda::std::complex;
23
26
using cuda::std::conj;
You can’t perform that action at this time.
0 commit comments