This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [gfortran] patch for pr 15413


On Sunday 16 May 2004 20:28, Janne Blomqvist wrote:
> On Sun, May 16, 2004 at 03:19:44PM +0100, Paul Brook wrote:
> > I've applied the patch with a couple of additions:
> > - The comment for write_logical no longer applies, so should be removed.
>
> I have to admit, I was kind of confused by that comment. I think there
> were two possible explanations:
>
> 1. That e.g.
>
> print *, .TRUE., .FALSE., .TRUE.
>
> and
>
> print '(L2, L2, L2)', .TRUE., .FALSE., .TRUE.
>
> should both print the same thing, e.g.
>
>  T F T
>
> In this case, the comment still applies even after the patch. I
> haven't access to the DEC compiler to test it, but g77, ifort and xlf
> do it this way. And now, also gfortran does it this way. So I think
> this is the best way, regardless of what DEC FORTRAN does.

It looks like this was the case as the real value formats also include extra 
padding. Patch below removes the excess. We still get these wrong, but I'm 
fairly sure that's a different bug.

Paul

2004-05-16  Paul Brook  <paul@codesourcery.com>

	* io/format.c (write_real): Don't include padding in format.

Index: io/write.c
===================================================================
RCS file: /var/cvsroot/gcc-cvs/gcc/libgfortran/io/write.c,v
retrieving revision 1.4
diff -u -p -r1.4 write.c
--- a/io/write.c	16 May 2004 14:07:58 -0000	1.4
+++ b/io/write.c	16 May 2004 20:14:31 -0000
@@ -986,8 +986,7 @@ write_character (const char *source, int
 
 
 /* Output the Real number with default format.
-   According to DEC fortran LRM, default format for
-   REAL(4) is 1PG15.7E2, and for REAL(8) is 1PG25.15E3  */
+   REAL(4) is 1PG14.7E2, and REAL(8) is 1PG23.15E3  */
 
 static void
 write_real (const char *source, int length)
@@ -998,13 +997,13 @@ write_real (const char *source, int leng
   g.scale_factor = 1;
   if (length < 8)
     {
-      f.u.real.w = 15;
+      f.u.real.w = 14;
       f.u.real.d = 7;
       f.u.real.e = 2;
     }
   else
     {
-      f.u.real.w = 24;
+      f.u.real.w = 23;
       f.u.real.d = 15;
       f.u.real.e = 3;
     }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]