public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libfortran/47285] New: G format outputs wrong number of characters when decimal supplied in literal
@ 2011-01-14  0:03 brendanarnold at gmail dot com
  2011-01-14  7:16 ` [Bug libfortran/47285] " jvdelisle at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: brendanarnold at gmail dot com @ 2011-01-14  0:03 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47285

           Summary: G format outputs wrong number of characters when
                    decimal supplied in literal
           Product: gcc
           Version: 4.4.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libfortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: brendanarnold@gmail.com


Try this program,


       PROGRAM FOO
       WRITE(*,100) -10000.

100    FORMAT(G5.5E5)

       STOP
       END

This outputs '-10000.' i.e. is 7 characters when it should be 5 c.f. this
program


       PROGRAM FOO
       WRITE(*,100) -10000

100    FORMAT(G5.5E5)

       STOP
       END

Note the decimal point in the literal. This outputs '*****'


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

* [Bug libfortran/47285] G format outputs wrong number of characters when decimal supplied in literal
  2011-01-14  0:03 [Bug libfortran/47285] New: G format outputs wrong number of characters when decimal supplied in literal brendanarnold at gmail dot com
@ 2011-01-14  7:16 ` jvdelisle at gcc dot gnu.org
  2011-01-14  7:22 ` burnus at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2011-01-14  7:16 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47285

Jerry DeLisle <jvdelisle at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2011.01.14 02:13:18
                 CC|                            |jvdelisle at gcc dot
                   |                            |gnu.org
         AssignedTo|unassigned at gcc dot       |jvdelisle at gcc dot
                   |gnu.org                     |gnu.org
     Ever Confirmed|0                           |1

--- Comment #1 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> 2011-01-14 02:13:18 UTC ---
I will have a go of it.


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

* [Bug libfortran/47285] G format outputs wrong number of characters when decimal supplied in literal
  2011-01-14  0:03 [Bug libfortran/47285] New: G format outputs wrong number of characters when decimal supplied in literal brendanarnold at gmail dot com
  2011-01-14  7:16 ` [Bug libfortran/47285] " jvdelisle at gcc dot gnu.org
@ 2011-01-14  7:22 ` burnus at gcc dot gnu.org
  2011-01-14 20:04 ` jvdelisle at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-01-14  7:22 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47285

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |burnus at gcc dot gnu.org

--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-01-14 07:15:45 UTC ---
Just for curiosity and comparison - results for other compilers:

I get the same output with gfortran (4.1, 4.3, and 4.6) and NAG f95:
>-10000.       <
>*****<

ifort, crayftn, pathf95, sunf95 and openf95* print for both programs ">*****<"
(i.e. also for the first one); g95 prints for the second one the ">*****<" -
and aborts w/ a run-time error for the first program ("G descriptor not wide
enough"). PGI segfaults for the first one and print ">*****<" for the second
one.

And g77 prints:
>       <
>       <

Note: I changed the format to FORMAT(">",G5.5E5,"<") to make it easier to see
tailing spaces.


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

* [Bug libfortran/47285] G format outputs wrong number of characters when decimal supplied in literal
  2011-01-14  0:03 [Bug libfortran/47285] New: G format outputs wrong number of characters when decimal supplied in literal brendanarnold at gmail dot com
  2011-01-14  7:16 ` [Bug libfortran/47285] " jvdelisle at gcc dot gnu.org
  2011-01-14  7:22 ` burnus at gcc dot gnu.org
@ 2011-01-14 20:04 ` jvdelisle at gcc dot gnu.org
  2011-01-22 14:26 ` jvdelisle at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2011-01-14 20:04 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47285

--- Comment #3 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> 2011-01-14 20:01:18 UTC ---
*** Bug 47284 has been marked as a duplicate of this bug. ***


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

* [Bug libfortran/47285] G format outputs wrong number of characters when decimal supplied in literal
  2011-01-14  0:03 [Bug libfortran/47285] New: G format outputs wrong number of characters when decimal supplied in literal brendanarnold at gmail dot com
                   ` (2 preceding siblings ...)
  2011-01-14 20:04 ` jvdelisle at gcc dot gnu.org
@ 2011-01-22 14:26 ` jvdelisle at gcc dot gnu.org
  2011-01-27  3:22 ` jvdelisle at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2011-01-22 14:26 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47285

--- Comment #4 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> 2011-01-22 13:53:52 UTC ---
Created attachment 23076
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23076
A possible patch

This patch seems to be acceptable.  I add a try return value to output float to
communicate when the field width is not successful. Oddly, I had to make an
adjustment to the exponent width to take care of a case that returns
successfully.

  if (e > 4)\
    e = 4;\

This seems to work, but I wonder if I have a latent bug within. This patch does
regression test OK. I thought I would let others play with it before I submit.


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

* [Bug libfortran/47285] G format outputs wrong number of characters when decimal supplied in literal
  2011-01-14  0:03 [Bug libfortran/47285] New: G format outputs wrong number of characters when decimal supplied in literal brendanarnold at gmail dot com
                   ` (3 preceding siblings ...)
  2011-01-22 14:26 ` jvdelisle at gcc dot gnu.org
@ 2011-01-27  3:22 ` jvdelisle at gcc dot gnu.org
  2011-01-27  3:32 ` jvdelisle at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2011-01-27  3:22 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47285

--- Comment #5 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> 2011-01-27 02:16:23 UTC ---
Author: jvdelisle
Date: Thu Jan 27 02:16:18 2011
New Revision: 169320

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=169320
Log:
2011-01-26  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

    PR libgfortran/47285
    * io/write_float.def (output_float): Return SUCCESS or FAILURE and use
    the result to set the padding.

Modified:
    trunk/libgfortran/ChangeLog
    trunk/libgfortran/io/write_float.def


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

* [Bug libfortran/47285] G format outputs wrong number of characters when decimal supplied in literal
  2011-01-14  0:03 [Bug libfortran/47285] New: G format outputs wrong number of characters when decimal supplied in literal brendanarnold at gmail dot com
                   ` (4 preceding siblings ...)
  2011-01-27  3:22 ` jvdelisle at gcc dot gnu.org
@ 2011-01-27  3:32 ` jvdelisle at gcc dot gnu.org
  2011-01-28 23:34 ` jvdelisle at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2011-01-27  3:32 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47285

Jerry DeLisle <jvdelisle at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED

--- Comment #6 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> 2011-01-27 02:20:02 UTC ---
Fixed on trunk, closing.


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

* [Bug libfortran/47285] G format outputs wrong number of characters when decimal supplied in literal
  2011-01-14  0:03 [Bug libfortran/47285] New: G format outputs wrong number of characters when decimal supplied in literal brendanarnold at gmail dot com
                   ` (5 preceding siblings ...)
  2011-01-27  3:32 ` jvdelisle at gcc dot gnu.org
@ 2011-01-28 23:34 ` jvdelisle at gcc dot gnu.org
  2011-02-02 18:04 ` dnovillo at gcc dot gnu.org
  2011-02-02 18:21 ` dnovillo at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2011-01-28 23:34 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47285

--- Comment #7 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> 2011-01-28 22:35:47 UTC ---
Author: jvdelisle
Date: Fri Jan 28 22:35:43 2011
New Revision: 169375

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=169375
Log:
2011-01-28  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

    PR libgfortran/47285
    * gfortran.dg/fmt_g.f: New test.

Added:
    trunk/gcc/testsuite/gfortran.dg/fmt_g.f
Modified:
    trunk/gcc/testsuite/ChangeLog


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

* [Bug libfortran/47285] G format outputs wrong number of characters when decimal supplied in literal
  2011-01-14  0:03 [Bug libfortran/47285] New: G format outputs wrong number of characters when decimal supplied in literal brendanarnold at gmail dot com
                   ` (6 preceding siblings ...)
  2011-01-28 23:34 ` jvdelisle at gcc dot gnu.org
@ 2011-02-02 18:04 ` dnovillo at gcc dot gnu.org
  2011-02-02 18:21 ` dnovillo at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: dnovillo at gcc dot gnu.org @ 2011-02-02 18:04 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47285

--- Comment #8 from Diego Novillo <dnovillo at gcc dot gnu.org> 2011-02-02 17:56:07 UTC ---
Author: dnovillo
Date: Wed Feb  2 17:56:02 2011
New Revision: 169640

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=169640
Log:
2011-01-26  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

    PR libgfortran/47285
    * io/write_float.def (output_float): Return SUCCESS or FAILURE and use
    the result to set the padding.

Modified:
    branches/google/integration/libgfortran/ChangeLog
    branches/google/integration/libgfortran/io/write_float.def


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

* [Bug libfortran/47285] G format outputs wrong number of characters when decimal supplied in literal
  2011-01-14  0:03 [Bug libfortran/47285] New: G format outputs wrong number of characters when decimal supplied in literal brendanarnold at gmail dot com
                   ` (7 preceding siblings ...)
  2011-02-02 18:04 ` dnovillo at gcc dot gnu.org
@ 2011-02-02 18:21 ` dnovillo at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: dnovillo at gcc dot gnu.org @ 2011-02-02 18:21 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47285

--- Comment #9 from Diego Novillo <dnovillo at gcc dot gnu.org> 2011-02-02 18:01:08 UTC ---
Author: dnovillo
Date: Wed Feb  2 18:00:57 2011
New Revision: 169675

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=169675
Log:
2011-01-28  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

    PR libgfortran/47285
    * gfortran.dg/fmt_g.f: New test.

Added:
    branches/google/integration/gcc/testsuite/gfortran.dg/fmt_g.f
Modified:
    branches/google/integration/gcc/testsuite/ChangeLog


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

end of thread, other threads:[~2011-02-02 18:21 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-14  0:03 [Bug libfortran/47285] New: G format outputs wrong number of characters when decimal supplied in literal brendanarnold at gmail dot com
2011-01-14  7:16 ` [Bug libfortran/47285] " jvdelisle at gcc dot gnu.org
2011-01-14  7:22 ` burnus at gcc dot gnu.org
2011-01-14 20:04 ` jvdelisle at gcc dot gnu.org
2011-01-22 14:26 ` jvdelisle at gcc dot gnu.org
2011-01-27  3:22 ` jvdelisle at gcc dot gnu.org
2011-01-27  3:32 ` jvdelisle at gcc dot gnu.org
2011-01-28 23:34 ` jvdelisle at gcc dot gnu.org
2011-02-02 18:04 ` dnovillo at gcc dot gnu.org
2011-02-02 18:21 ` dnovillo at gcc dot gnu.org

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).