+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
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
--- /dev/null
+! { 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
+
+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
{
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] = '.';