From 17314cd9eb95fd1d2390cf6bceed6c329194ddf8 Mon Sep 17 00:00:00 2001 From: Tobias Burnus Date: Tue, 8 Dec 2009 15:12:06 +0100 Subject: [PATCH] re PR libfortran/41711 ([F08] BOZ edit-descr does not support reading large kind reals) 2009-12-08 Tobias Burnus PR fortran/41711 * io/read.c (set_integer): Support kind=10 for reading real/complex BOZ. 2009-12-08 Tobias Burnus PR fortran/41711 * gfortran.dg/boz_15.f90: New test. From-SVN: r155088 --- gcc/testsuite/ChangeLog | 5 +++ gcc/testsuite/gfortran.dg/boz_15.f90 | 49 ++++++++++++++++++++++++++++ libgfortran/ChangeLog | 6 ++++ libgfortran/io/read.c | 2 ++ 4 files changed, 62 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/boz_15.f90 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index cafd4671db8a..c054565a6cfb 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2009-12-08 Tobias Burnus + + PR fortran/41711 + * gfortran.dg/boz_15.f90: New test. + 2008-12-08 Daniel Kraft PR fortran/41177 diff --git a/gcc/testsuite/gfortran.dg/boz_15.f90 b/gcc/testsuite/gfortran.dg/boz_15.f90 new file mode 100644 index 000000000000..40ad514cffdc --- /dev/null +++ b/gcc/testsuite/gfortran.dg/boz_15.f90 @@ -0,0 +1,49 @@ +! { dg-do run } +! { dg-require-effective-target fortran_large_real } +! { dg-require-effective-target fortran_large_int } +! +! PR fortran/41711 +! +! Check reading and writing of real(10/16) BOZ, +! which needs integer(16) support. +! +implicit none +character(len=255) :: str +integer,parameter :: xp = selected_real_kind (precision (0.0d0)+1) +real(xp) :: r1,r2 +complex(xp) :: z1,z2 + +r2 = 5.0_xp +r1 = 2.0_xp +! Real B(OZ) +write(str,'(b126)') r1 +read (str,'(b126)') r2 +if(r2 /= r1) call abort() +! Real (B)O(Z) +r2 = 5.0_xp +write(str,'(o126)') r1 +read (str,'(o126)') r2 +if(r2 /= r1) call abort() +! Real (BO)Z +r2 = 5.0_xp +write(str,'(z126)') r1 +read (str,'(z126)') r2 +if(r2 /= r1) call abort() + +z2 = cmplx(5.0_xp,7.0_xp) +z1 = cmplx(2.0_xp,3.0_xp) +! Complex B(OZ) +write(str,'(2b126)') z1 +read (str,'(2b126)') z2 +if(z2 /= z1) call abort() +! Complex (B)O(Z) +z2 = cmplx(5.0_xp,7.0_xp) +write(str,'(2o126)') z1 +read (str,'(2o126)') z2 +if(z2 /= z1) call abort() +! Complex (BO)Z +z2 = cmplx(5.0_xp,7.0_xp) +write(str,'(2z126)') z1 +read (str,'(2z126)') z2 +if(z2 /= z1) call abort() +end diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog index 3c63896e2ee7..936163965c78 100644 --- a/libgfortran/ChangeLog +++ b/libgfortran/ChangeLog @@ -1,3 +1,9 @@ +2009-12-08 Tobias Burnus + + PR fortran/41711 + * io/read.c (set_integer): Support kind=10 for reading + real/complex BOZ. + 2009-12-06 Janus Weil PR fortran/41478 diff --git a/libgfortran/io/read.c b/libgfortran/io/read.c index a5cb97a00e57..03046b943b99 100644 --- a/libgfortran/io/read.c +++ b/libgfortran/io/read.c @@ -45,6 +45,8 @@ set_integer (void *dest, GFC_INTEGER_LARGEST value, int length) switch (length) { #ifdef HAVE_GFC_INTEGER_16 +/* length=10 comes about for kind=10 real/complex BOZ, cf. PR41711. */ + case 10: case 16: { GFC_INTEGER_16 tmp = value; -- 2.43.5