aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancois-Xavier Coudert <coudert@clipper.ens.fr>2006-02-06 00:04:07 +0100
committerFrançois-Xavier Coudert <fxcoudert@gcc.gnu.org>2006-02-05 23:04:07 +0000
commitdf6ea7845609291ef6e8a3607933f1651edecc14 (patch)
treee9d35e287442cd93c334d4c6bf6ce320e8aec522
parent0b59f49d59928689e9816c89d3b02765f9ac49ba (diff)
downloadgcc-df6ea7845609291ef6e8a3607933f1651edecc14.zip
gcc-df6ea7845609291ef6e8a3607933f1651edecc14.tar.gz
gcc-df6ea7845609291ef6e8a3607933f1651edecc14.tar.bz2
re PR libfortran/24685 (real(16) formatted input is broken for huge values (gfortran.dg/default_format_2.f90))
PR libfortran/24685 * io/write.c (write_real): Widen the default format for real(10) variables output. * gfortran.dg/large_real_kind_form_io_2.f90: New test. From-SVN: r110627
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gfortran.dg/large_real_kind_form_io_2.f9033
-rw-r--r--libgfortran/ChangeLog6
-rw-r--r--libgfortran/io/write.c4
4 files changed, 46 insertions, 2 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index d21d5a7..34202b7 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2006-02-06 Francois-Xavier Coudert <coudert@clipper.ens.fr>
+
+ PR libfortran/24685
+ * gfortran.dg/large_real_kind_form_io_2.f90: New test.
+
2006-02-05 Andrew Pinski <pinskia@physics.uc.edu>
PR tree-opt/25251
diff --git a/gcc/testsuite/gfortran.dg/large_real_kind_form_io_2.f90 b/gcc/testsuite/gfortran.dg/large_real_kind_form_io_2.f90
new file mode 100644
index 0000000..d48e3d5
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/large_real_kind_form_io_2.f90
@@ -0,0 +1,33 @@
+! { dg-do run }
+! { dg-require-effective-target fortran_large_real }
+! PR libfortran/24685
+program large_real_kind_form_io_2
+ ! This should be 10 or 16 on systems that support kind=10 or kind=16
+ integer, parameter :: k = selected_real_kind (precision (0.0_8) + 1)
+ real(kind=k) :: a,b(2), c
+ character(len=180) :: tmp
+
+ b(:) = huge(0.0_k)
+ write (tmp, *) b
+ read (tmp, *) a, c
+ if (a /= b(1)) call abort ()
+ if (c /= b(2)) call abort ()
+
+ b(:) = -huge(0.0_k)
+ write (tmp, *) b
+ read (tmp, *) a, c
+ if (a /= b(1)) call abort ()
+ if (c /= b(2)) call abort ()
+
+ b(:) = tiny(0.0_k)
+ write (tmp, *) b
+ read (tmp, *) a, c
+ if (a /= b(1)) call abort ()
+ if (c /= b(2)) call abort ()
+
+ b(:) = -tiny(0.0_k)
+ write (tmp, *) b
+ read (tmp, *) a, c
+ if (a /= b(1)) call abort ()
+ if (c /= b(2)) call abort ()
+end program large_real_kind_form_io_2
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index 04d68f0..ef4db4f 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,9 @@
+2006-02-06 Francois-Xavier Coudert <coudert@clipper.ens.fr>
+
+ PR libfortran/24685
+ * io/write.c (write_real): Widen the default format for real(10)
+ variables output.
+
2006-01-24 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/25835
diff --git a/libgfortran/io/write.c b/libgfortran/io/write.c
index d6323f4..d7ce6c5 100644
--- a/libgfortran/io/write.c
+++ b/libgfortran/io/write.c
@@ -1373,8 +1373,8 @@ write_real (st_parameter_dt *dtp, const char *source, int length)
f.u.real.e = 3;
break;
case 10:
- f.u.real.w = 24;
- f.u.real.d = 15;
+ f.u.real.w = 28;
+ f.u.real.d = 19;
f.u.real.e = 4;
break;
case 16: