backport: re PR libfortran/83811 (fortran 'e' format broken for single digit exponents)

2018-01-14  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	Backport from trunk
	PR libgfortran/83811
	* gfortran.dg/fmt_e.f90: New test.

	* gfortran.dg/fmt_e.f90: New test.

From-SVN: r256675
This commit is contained in:
Jerry DeLisle 2018-01-14 21:44:50 +00:00
parent ed402c475a
commit 6e3d1ae6e1
4 changed files with 25 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2018-01-14 Jerry DeLisle <jvdelisle@gcc.gnu.org>
Backport from trunk
PR libgfortran/83811
* gfortran.dg/fmt_e.f90: New test.
2018-01-14 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
Backport from mainline

View File

@ -0,0 +1,10 @@
! { dg-do run }
! PR83811 fortran 'e' format broken for single digit exponents
program test
character(25) :: s
write(s, '(1pe5.0e1)') 1.e-4
if (s.ne."1.E-4") call abort
write(s, '(e5.1e1)') 1.e12
if (s.ne."*****") call abort
end

View File

@ -1,3 +1,9 @@
2018-01-14 Jerry DeLisle <jvdelisle@gcc.gnu.org>
Backport from trunk
PR libgfortran/83811
* write.c (select_buffer): Adjust buffer size up by 1.
2018-01-03 Janne Blomqvist <jb@gcc.gnu.org>
Backport from trunk

View File

@ -1537,8 +1537,9 @@ select_buffer (st_parameter_dt *dtp, const fnode *f, int precision,
{
char *result;
/* The buffer needs at least one more byte to allow room for normalizing. */
*size = size_from_kind (dtp, f, kind) + precision + 1;
/* The buffer needs at least one more byte to allow room for
normalizing and 1 to hold null terminator. */
*size = size_from_kind (dtp, f, kind) + precision + 1 + 1;
if (*size > BUF_STACK_SZ)
result = xmalloc (*size);