re PR libfortran/77393 (Revision r237735 changed the behavior of F0.0)
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. * gfortran.dg/fmt_f0_2.f90: Update test. * gfortran.dg/fmt_f0_3.f90: New test. From-SVN: r240018
This commit is contained in:
parent
6ac7322b3e
commit
5dcf68f510
@ -1,3 +1,9 @@
|
||||
2016-09-16 Jerry DeLisle <jvdelisle@gcc.gnu.org>
|
||||
|
||||
PR libgfortran/77393
|
||||
* gfortran.dg/fmt_f0_2.f90: Update test.
|
||||
* gfortran.dg/fmt_f0_3.f90: New test.
|
||||
|
||||
2016-09-07 Dominique d'Humieres <dominiq@lps.ens.fr>
|
||||
|
||||
PR debug/77389
|
||||
|
@ -11,16 +11,12 @@ program testbigf0 ! Can enormous numbers be printed with F0.0 format?
|
||||
select case (i)
|
||||
case (1)
|
||||
write(str, "(f0.0)") -huge(real(1.0,kind=j(1)))
|
||||
if (len(trim(str)).lt.41) error stop "FAILED AT LINE 15"
|
||||
case (2)
|
||||
write(str, "(f0.0)") -huge(real(1.0,kind=j(2)))
|
||||
if (len(trim(str)).lt.311) error stop "FAILED AT LINE 19"
|
||||
case (3)
|
||||
write(str, "(f0.0)") -huge(real(1.0,kind=j(3)))
|
||||
if (len(trim(str)).lt.4935) error stop "FAILED AT LINE 23"
|
||||
case (4)
|
||||
write(str, "(f0.10)") -huge(real(1.0,kind=j(4)))
|
||||
if (len(trim(str)).lt.4945) error stop "FAILED AT LINE 27"
|
||||
end select
|
||||
enddo
|
||||
end program testbigf0
|
||||
|
23
gcc/testsuite/gfortran.dg/fmt_f0_3.f90
Normal file
23
gcc/testsuite/gfortran.dg/fmt_f0_3.f90
Normal file
@ -0,0 +1,23 @@
|
||||
! { dg-do run }
|
||||
! PR77393, this segfaulted before
|
||||
program testbigf0
|
||||
use ISO_FORTRAN_ENV
|
||||
implicit none
|
||||
integer i
|
||||
integer, parameter :: j(size(real_kinds)+4)=[REAL_KINDS, [4, 4, 4, 4]]
|
||||
character(10000) :: str
|
||||
|
||||
do i=1,size(real_kinds)
|
||||
select case (i)
|
||||
case (1)
|
||||
write(str, "(f8.0)") huge(real(1.0,kind=j(1)))
|
||||
case (2)
|
||||
write(str, "(f18.0)") huge(real(1.0,kind=j(2)))
|
||||
case (3)
|
||||
write(str, "(f20.0)") huge(real(1.0,kind=j(3)))
|
||||
case (4)
|
||||
write(str, "(f40.0)") huge(real(1.0,kind=j(4)))
|
||||
end select
|
||||
enddo
|
||||
end program testbigf0
|
||||
|
@ -1,3 +1,10 @@
|
||||
2016-09-16 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
|
||||
|
@ -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] = '.';
|
||||
|
Loading…
Reference in New Issue
Block a user