aboutsummaryrefslogtreecommitdiff
path: root/libgfortran
diff options
context:
space:
mode:
authorFrancois-Xavier Coudert <fxcoudert@gcc.gnu.org>2022-09-21 11:06:19 +0200
committerFrancois-Xavier Coudert <fxcoudert@gmail.com>2022-09-21 11:15:21 +0200
commit519196a27cf534e94f158733b25a4f9d10737031 (patch)
tree5975060cec8fbe5e33d55feeb6d0f24175d480da /libgfortran
parentdd9e5f4db2debf1429feab7f785962ccef6e0dbd (diff)
downloadgcc-519196a27cf534e94f158733b25a4f9d10737031.zip
gcc-519196a27cf534e94f158733b25a4f9d10737031.tar.gz
gcc-519196a27cf534e94f158733b25a4f9d10737031.tar.bz2
Fortran: handle RADIX kind in IEEE_SET_ROUNDING_MODE
Make sure that calling IEEE_SET_ROUNDING_MODE with RADIX=10 does not affect the binary rounding mode. 2022-09-21 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> libgfortran/ * ieee/ieee_arithmetic.F90 (IEEE_SET_ROUNDING_MODE): Handle RADIX argument better. gcc/testsuite/ * gfortran.dg/ieee/rounding_3.f90: New test.
Diffstat (limited to 'libgfortran')
-rw-r--r--libgfortran/ieee/ieee_arithmetic.F9012
1 files changed, 9 insertions, 3 deletions
diff --git a/libgfortran/ieee/ieee_arithmetic.F90 b/libgfortran/ieee/ieee_arithmetic.F90
index ce30e4a..4c8e3bb 100644
--- a/libgfortran/ieee/ieee_arithmetic.F90
+++ b/libgfortran/ieee/ieee_arithmetic.F90
@@ -816,7 +816,7 @@ REM_MACRO(4,4,4)
IEEE_SUPPORT_ROUNDING_NOARG
end interface
public :: IEEE_SUPPORT_ROUNDING
-
+
! Interface to the FPU-specific function
interface
pure integer function support_rounding_helper(flag) &
@@ -839,7 +839,7 @@ REM_MACRO(4,4,4)
IEEE_SUPPORT_UNDERFLOW_CONTROL_NOARG
end interface
public :: IEEE_SUPPORT_UNDERFLOW_CONTROL
-
+
! Interface to the FPU-specific function
interface
pure integer function support_underflow_control_helper(kind) &
@@ -1074,7 +1074,13 @@ contains
integer, value :: val
end subroutine
end interface
-
+
+ ! We do not support RADIX = 10, and such calls should not
+ ! modify the binary rounding mode.
+ if (present(RADIX)) then
+ if (RADIX == 10) return
+ end if
+
call helper(ROUND_VALUE%hidden)
end subroutine