public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [patch, libgfortran] Fix oddity in formatted write
@ 2008-11-19  6:36 jvdelisle
  2008-11-20 10:07 ` Tobias Burnus
  0 siblings, 1 reply; 2+ messages in thread
From: jvdelisle @ 2008-11-19  6:36 UTC (permalink / raw)
  To: gcc-patches, fortran

This is a very simple patch.

With this test case:

       PROGRAM bug
       IMPLICIT NONE

       DOUBLE PRECISION r
       COMMON /gggg91/ r

       DOUBLE PRECISION  x

       x = 1000
       write(6,*) 'x = ', x
       x = 1001
       write(6,*) 'x = ', x
       x = 999
       write(6,*) 'x = ', x
       x = 100
       write(6,*) 'x = ', x
       x = 101
       write(6,*) 'x = ', x
       x = 99
       write(6,*) 'x = ', x
       END

Before this patch we get:

  x =   1000.00000000000000
  x =    1001.0000000000000
  x =    999.00000000000000
  x =   100.000000000000000
  x =    101.00000000000000
  x =    99.000000000000000

After the patch we get:

  x =    1000.0000000000000
  x =    1001.0000000000000
  x =    999.00000000000000
  x =    100.00000000000000
  x =    101.00000000000000
  x =    99.000000000000000

This was first reported in PR37472.  This patch does not fix that PR but 
does straighten out the formatting.  It requires a slight change to 
namelist_print_1.f90.  Regression tested on x86-64-Gnu-linux.

OK for trunk?

Jerry

Index: write_float.def
===================================================================
--- write_float.def	(revision 141988)
+++ write_float.def	(working copy)
@@ -652,7 +652,10 @@ output_float_FMT_G_ ## x (st_parameter_d
            low = mid + 1;\
          }\
        else\
-        break;\
+	{\
+	  mid++;\
+	  break;\
+	}\
      }\
  \
    if (e < 0)\

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [patch, libgfortran] Fix oddity in formatted write
  2008-11-19  6:36 [patch, libgfortran] Fix oddity in formatted write jvdelisle
@ 2008-11-20 10:07 ` Tobias Burnus
  0 siblings, 0 replies; 2+ messages in thread
From: Tobias Burnus @ 2008-11-20 10:07 UTC (permalink / raw)
  To: jvdelisle; +Cc: gcc-patches, fortran

jvdelisle@verizon.net wrote:
> This was first reported in PR37472.  This patch does not fix that PR
> but does straighten out the formatting.  It requires a slight change
> to namelist_print_1.f90.  Regression tested on x86-64-Gnu-linux.
> OK for trunk?
OK with a changelog.

(The output is then in line with ifort and also that the digits start
after a fixed amount of spaces after the "=" is in line with g95, f95,
openf95 and sunf95.)

Tobias

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-11-20  9:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-11-19  6:36 [patch, libgfortran] Fix oddity in formatted write jvdelisle
2008-11-20 10:07 ` Tobias Burnus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).