summaryrefslogtreecommitdiff
path: root/flang/runtime
diff options
context:
space:
mode:
authorpeter klausler <pklausler@nvidia.com>2020-01-09 14:01:40 -0800
committerpeter klausler <pklausler@nvidia.com>2020-01-09 14:01:40 -0800
commit9e6d1a7892123b4334ff42ad2919ee76a01a6e98 (patch)
tree5db3184bc969ca917a5d1cf770f4cb08ba22a5db /flang/runtime
parent1c21916785af908a60a04ca8634ce38d79b49e16 (diff)
downloadllvm-9e6d1a7892123b4334ff42ad2919ee76a01a6e98.tar.gz
[flang] Dodge build problem in some Power environments
Original-commit: flang-compiler/f18@f24abf19c4aac3869459cd0984473ea3b5232d12 Reviewed-on: https://github.com/flang-compiler/f18/pull/919
Diffstat (limited to 'flang/runtime')
-rw-r--r--flang/runtime/main.cc11
-rw-r--r--flang/runtime/stop.cc7
2 files changed, 17 insertions, 1 deletions
diff --git a/flang/runtime/main.cc b/flang/runtime/main.cc
index dbfcd2b11d62..58053b13ac80 100644
--- a/flang/runtime/main.cc
+++ b/flang/runtime/main.cc
@@ -22,11 +22,22 @@ extern "C" {
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();
diff --git a/flang/runtime/stop.cc b/flang/runtime/stop.cc
index 250031e31809..5027c7002785 100644
--- a/flang/runtime/stop.cc
+++ b/flang/runtime/stop.cc
@@ -15,7 +15,12 @@
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);