From b8f412849b4fbc170fcc9cf1053d44cfc4165d48 Mon Sep 17 00:00:00 2001 From: Dominique d'Humieres Date: Mon, 25 Feb 2019 11:39:38 +0100 Subject: [PATCH] re PR libfortran/89274 (Inconsistent list directed output of INTEGER(16)) 2019-02-25 Dominique d'Humieres PR libfortran/89274 * gfortran.dg/list_directed_large.f90: New test. 2019-02-25 Dominique d'Humieres PR libfortran/89274 * io/write.c (write_integer): Add width for INTEGER(16). From-SVN: r269187 --- gcc/testsuite/ChangeLog | 5 +++++ .../gfortran.dg/list_directed_large.f90 | 16 ++++++++++++++++ libgfortran/ChangeLog | 5 +++++ libgfortran/io/write.c | 4 ++++ 4 files changed, 30 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/list_directed_large.f90 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 70e692bcec7..bbe27aa83a6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-02-25 Dominique d'Humieres + + PR libfortran/89274 + * gfortran.dg/list_directed_large.f90: New test. + 2019-02-25 Jakub Jelinek PR target/89434 diff --git a/gcc/testsuite/gfortran.dg/list_directed_large.f90 b/gcc/testsuite/gfortran.dg/list_directed_large.f90 new file mode 100644 index 00000000000..ab631d7b15f --- /dev/null +++ b/gcc/testsuite/gfortran.dg/list_directed_large.f90 @@ -0,0 +1,16 @@ +! { dg-do run } +! { dg-require-effective-target fortran_large_int } +! PR libfortran/89274 Inconsistent list directed output of INTEGER(16) +! +integer(16) :: j(2) +character(82) :: str +j = huge(1_16) +write(str,*) j +if (str /= " 170141183460469231731687303715884105727 170141183460469231731687303715884105727") stop 1 +j = 1 +write(str,*) j +if (str /= " 1 1") stop 2 +j = -huge(1_16) +write(str,*) j +if (str /= " -170141183460469231731687303715884105727 -170141183460469231731687303715884105727") stop 3 +end diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index d0a3962ba29..0941b5876fd 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,8 @@ +2019-02-25 Dominique d'Humieres + + PR libfortran/89274 + * io/write.c (write_integer): Add width for INTEGER(16). + 2019-02-23 Paul Thomas PR fortran/89385 diff --git a/libgfortran/io/write.c b/libgfortran/io/write.c index 449b35ff4c8..c8811e200e0 100644 --- a/libgfortran/io/write.c +++ b/libgfortran/io/write.c @@ -1342,6 +1342,10 @@ write_integer (st_parameter_dt *dtp, const char *source, int kind) width = 20; break; + case 16: + width = 40; + break; + default: width = 0; break; -- 2.30.2