void __FortranProgram(); // PROGRAM statement
int main(int argc, const char *argv[], const char *envp[]) {
+
Fortran::runtime::argc = argc;
Fortran::runtime::argv = argv;
Fortran::runtime::envp = envp;
+
+#ifdef feclearexcept // a macro in some environments; omit std::
+ feclearexcept(FE_ALL_EXCEPT);
+#else
std::feclearexcept(FE_ALL_EXCEPT);
+#endif
+#ifdef fesetround
+ fesetround(FE_TONEAREST);
+#else
std::fesetround(FE_TONEAREST);
+#endif
+
std::atexit(Fortran::runtime::NotifyOtherImagesOfNormalEnd);
// TODO: Runtime configuration settings from environment
__FortranProgram();
extern "C" {
static void DescribeIEEESignaledExceptions() {
- if (auto excepts{std::fetestexcept(FE_ALL_EXCEPT)}) {
+#ifdef fetestexcept // a macro in some environments; omit std::
+ auto excepts{fetestexcept(FE_ALL_EXCEPT)};
+#else
+ auto excepts{std::fetestexcept(FE_ALL_EXCEPT)};
+#endif
+ if (excepts) {
std::fputs("IEEE arithmetic exceptions signaled:", stderr);
if (excepts & FE_DIVBYZERO) {
std::fputs(" DIVBYZERO", stderr);