2009-12-08 Tobias Burnus <burnus@net-b.de>
authorburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 8 Dec 2009 14:12:06 +0000 (14:12 +0000)
committerburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 8 Dec 2009 14:12:06 +0000 (14:12 +0000)
        PR fortran/41711
        * io/read.c (set_integer): Support kind=10 for reading
        real/complex BOZ.

2009-12-08  Tobias Burnus  <burnus@net-b.de>

        PR fortran/41711
        * gfortran.dg/boz_15.f90: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@155088 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/boz_15.f90 [new file with mode: 0644]
libgfortran/ChangeLog
libgfortran/io/read.c

index cafd467..c054565 100644 (file)
@@ -1,3 +1,8 @@
+2009-12-08  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/41711
+       * gfortran.dg/boz_15.f90: New test.
+
 2008-12-08  Daniel Kraft  <d@domob.eu>
 
        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 (file)
index 0000000..40ad514
--- /dev/null
@@ -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
index 3c63896..9361639 100644 (file)
@@ -1,3 +1,9 @@
+2009-12-08  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/41711
+       * io/read.c (set_integer): Support kind=10 for reading
+       real/complex BOZ.
+
 2009-12-06  Janus Weil  <janus@gcc.gnu.org>
 
        PR fortran/41478
index a5cb97a..03046b9 100644 (file)
@@ -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;