diff options
Diffstat (limited to 'libgfortran')
-rw-r--r-- | libgfortran/ChangeLog | 13 | ||||
-rw-r--r-- | libgfortran/ieee/ieee_arithmetic.F90 | 33 | ||||
-rw-r--r-- | libgfortran/io/write_float.def | 7 |
3 files changed, 37 insertions, 16 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 256805a3db6..6454eaeb826 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,16 @@ +2016-09-09 Steven G. Kargl <kargl@gcc.gnu.org> + + PR fortran/77507 + * ieee/ieee_arithmetic.F90 (IEEE_VALUE_4,IEEE_VALUE_8,IEEE_VALULE_10, + IEEE_VALUE_16): Use correct keyword. + +2016-09-06 Jerry DeLisle <jvdelisle@gcc.gnu.org> + + PR libgfortran/77393 + * io/write_float.def (build_float_string): Recognize when the + result will not fit in the user provided, star fill, and exit + early. + 2016-08-31 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libgfortran/77393 diff --git a/libgfortran/ieee/ieee_arithmetic.F90 b/libgfortran/ieee/ieee_arithmetic.F90 index 16e79eceb9a..4007a33358e 100644 --- a/libgfortran/ieee/ieee_arithmetic.F90 +++ b/libgfortran/ieee/ieee_arithmetic.F90 @@ -857,12 +857,12 @@ contains ! IEEE_VALUE - elemental real(kind=4) function IEEE_VALUE_4(X, C) result(res) - implicit none + elemental real(kind=4) function IEEE_VALUE_4(X, CLASS) result(res) + real(kind=4), intent(in) :: X - type(IEEE_CLASS_TYPE), intent(in) :: C + type(IEEE_CLASS_TYPE), intent(in) :: CLASS - select case (C%hidden) + select case (CLASS%hidden) case (1) ! IEEE_SIGNALING_NAN res = -1 res = sqrt(res) @@ -895,12 +895,12 @@ contains end select end function - elemental real(kind=8) function IEEE_VALUE_8(X, C) result(res) - implicit none + elemental real(kind=8) function IEEE_VALUE_8(X, CLASS) result(res) + real(kind=8), intent(in) :: X - type(IEEE_CLASS_TYPE), intent(in) :: C + type(IEEE_CLASS_TYPE), intent(in) :: CLASS - select case (C%hidden) + select case (CLASS%hidden) case (1) ! IEEE_SIGNALING_NAN res = -1 res = sqrt(res) @@ -934,12 +934,12 @@ contains end function #ifdef HAVE_GFC_REAL_10 - elemental real(kind=10) function IEEE_VALUE_10(X, C) result(res) - implicit none + elemental real(kind=10) function IEEE_VALUE_10(X, CLASS) result(res) + real(kind=10), intent(in) :: X - type(IEEE_CLASS_TYPE), intent(in) :: C + type(IEEE_CLASS_TYPE), intent(in) :: CLASS - select case (C%hidden) + select case (CLASS%hidden) case (1) ! IEEE_SIGNALING_NAN res = -1 res = sqrt(res) @@ -971,15 +971,16 @@ contains res = 0 end select end function + #endif #ifdef HAVE_GFC_REAL_16 - elemental real(kind=16) function IEEE_VALUE_16(X, C) result(res) - implicit none + elemental real(kind=16) function IEEE_VALUE_16(X, CLASS) result(res) + real(kind=16), intent(in) :: X - type(IEEE_CLASS_TYPE), intent(in) :: C + type(IEEE_CLASS_TYPE), intent(in) :: CLASS - select case (C%hidden) + select case (CLASS%hidden) case (1) ! IEEE_SIGNALING_NAN res = -1 res = sqrt(res) diff --git a/libgfortran/io/write_float.def b/libgfortran/io/write_float.def index 04223c043a3..504482fa170 100644 --- a/libgfortran/io/write_float.def +++ b/libgfortran/io/write_float.def @@ -174,6 +174,13 @@ build_float_string (st_parameter_dt *dtp, const fnode *f, char *buffer, { case FMT_F: nbefore = ndigits - precision; + if ((w > 0) && (nbefore > (int) size)) + { + *len = w; + star_fill (result, w); + result[w] = '\0'; + return; + } /* Make sure the decimal point is a '.'; depending on the locale, this might not be the case otherwise. */ digits[nbefore] = '.'; |