public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libfortran/48684] New: Incorrect field alignment with Gw.dEe descriptor
@ 2011-04-19 14:11 thenlich at users dot sourceforge.net
  2011-04-19 14:14 ` [Bug libfortran/48684] " burnus at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: thenlich at users dot sourceforge.net @ 2011-04-19 14:11 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: Incorrect field alignment with Gw.dEe descriptor
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: libfortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: thenlich@users.sourceforge.net


With a Gw.dEe descriptor the output is formatted incorrectly if the F
conversion is selected and an exponent width e>4 is selected.

The conversion in this case is F(n-4).(d-x).n('b')

The constant n is required by Fortran 2008 to be e + 2.

But it is incorrectly calculated by GFortran as min(e, 4) + 2

print "(g15.3e5)", 0.1d0
print "(g15.3e5)", 0.1d12
Output:
    0.100
   0.100E+00012

Expected output:
   0.100
   0.100E+00012


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

* [Bug libfortran/48684] Incorrect field alignment with Gw.dEe descriptor
  2011-04-19 14:11 [Bug libfortran/48684] New: Incorrect field alignment with Gw.dEe descriptor thenlich at users dot sourceforge.net
@ 2011-04-19 14:14 ` burnus at gcc dot gnu.org
  2011-04-19 14:59 ` thenlich at users dot sourceforge.net
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-04-19 14:14 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-04-19 14:14:15 UTC ---
Isn't this related to PR 48682 ?


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

* [Bug libfortran/48684] Incorrect field alignment with Gw.dEe descriptor
  2011-04-19 14:11 [Bug libfortran/48684] New: Incorrect field alignment with Gw.dEe descriptor thenlich at users dot sourceforge.net
  2011-04-19 14:14 ` [Bug libfortran/48684] " burnus at gcc dot gnu.org
@ 2011-04-19 14:59 ` thenlich at users dot sourceforge.net
  2011-04-20  3:36 ` jvdelisle at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: thenlich at users dot sourceforge.net @ 2011-04-19 14:59 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Thomas Henlich <thenlich at users dot sourceforge.net> 2011-04-19 14:59:36 UTC ---
(In reply to comment #1)
> Isn't this related to PR 48682 ?

Just a coincidence. BTW PR 48682 can be closed as invalid.

BTW: Above should read: The conversion in this case is F(w-n).(d-x).n('b')


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

* [Bug libfortran/48684] Incorrect field alignment with Gw.dEe descriptor
  2011-04-19 14:11 [Bug libfortran/48684] New: Incorrect field alignment with Gw.dEe descriptor thenlich at users dot sourceforge.net
  2011-04-19 14:14 ` [Bug libfortran/48684] " burnus at gcc dot gnu.org
  2011-04-19 14:59 ` thenlich at users dot sourceforge.net
@ 2011-04-20  3:36 ` jvdelisle at gcc dot gnu.org
  2011-04-23 21:28 ` 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-04-20  3:36 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2011.04.20 03:35:30
         AssignedTo|unassigned at gcc dot       |jvdelisle at gcc dot
                   |gnu.org                     |gnu.org
     Ever Confirmed|0                           |1

--- Comment #3 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> 2011-04-20 03:35:30 UTC ---
OK, got one or two in front of this.


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

* [Bug libfortran/48684] Incorrect field alignment with Gw.dEe descriptor
  2011-04-19 14:11 [Bug libfortran/48684] New: Incorrect field alignment with Gw.dEe descriptor thenlich at users dot sourceforge.net
                   ` (2 preceding siblings ...)
  2011-04-20  3:36 ` jvdelisle at gcc dot gnu.org
@ 2011-04-23 21:28 ` jvdelisle at gcc dot gnu.org
  2011-04-23 21:51 ` jvdelisle at frontier dot com
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2011-04-23 21:28 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> 2011-04-23 21:27:22 UTC ---
lets expand the test case just a little:

print "(a)", "12345678901234567890"
print "(g15.3e5)", 0.1d0
print "(g15.3e5)", 0.1d1
print "(g15.3e5)", 0.1d2
print "(g15.3e5)", 0.1d3
print "(g15.3e5)", 0.1d4
print "(g15.3e5)", 0.1d5
print "(g15.3e5)", 0.1d6
print "(g15.3e5)", 0.1d7
print "(g15.3e5)", 0.1d8
print "(g15.3e5)", 0.1d9
print "(g15.3e5)", 0.1d10
print "(g15.3e5)", 0.1d11
print "(g15.3e5)", 0.1d12
end

Unpatched gfortran and ifort give:

12345678901234567890
   0.100       
    1.00       
    10.0       
    100.       
   0.100E+00004
   0.100E+00005
   0.100E+00006
   0.100E+00007
   0.100E+00008
   0.100E+00009
   0.100E+00010
   0.100E+00011
   0.100E+00012

With a very minor patch, we can get this:

   0.100       
    1.00       
    10.0       
    100.       
   0.100E+00004
   0.100E+00005
   0.100E+00006
   0.100E+00007
   0.100E+00008
   0.100E+00009
   0.100E+00010
   0.100E+00011
   0.100E+00012

My question, are the values of 1.0, 10.0, and 100. formatted correctly?


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

* [Bug libfortran/48684] Incorrect field alignment with Gw.dEe descriptor
  2011-04-19 14:11 [Bug libfortran/48684] New: Incorrect field alignment with Gw.dEe descriptor thenlich at users dot sourceforge.net
                   ` (3 preceding siblings ...)
  2011-04-23 21:28 ` jvdelisle at gcc dot gnu.org
@ 2011-04-23 21:51 ` jvdelisle at frontier dot com
  2011-04-25  8:47 ` thenlich at users dot sourceforge.net
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jvdelisle at frontier dot com @ 2011-04-23 21:51 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from jvdelisle at frontier dot com 2011-04-23 21:50:54 UTC ---
On 04/23/2011 02:27 PM, jvdelisle at gcc dot gnu.org wrote:
--- snip ---
>
> Unpatched gfortran and ifort give:

I meant patched gfortran and ifort give:
>
> 12345678901234567890
>     0.100
>      1.00
>      10.0
>      100.
>     0.100E+00004
>     0.100E+00005
>     0.100E+00006
>     0.100E+00007
>     0.100E+00008
>     0.100E+00009
>     0.100E+00010
>     0.100E+00011
>     0.100E+00012
--- snip ---
>
> My question, are the values of 1.0, 10.0, and 100. formatted correctly?
>


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

* [Bug libfortran/48684] Incorrect field alignment with Gw.dEe descriptor
  2011-04-19 14:11 [Bug libfortran/48684] New: Incorrect field alignment with Gw.dEe descriptor thenlich at users dot sourceforge.net
                   ` (4 preceding siblings ...)
  2011-04-23 21:51 ` jvdelisle at frontier dot com
@ 2011-04-25  8:47 ` thenlich at users dot sourceforge.net
  2011-04-29 14:57 ` jvdelisle at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: thenlich at users dot sourceforge.net @ 2011-04-25  8:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Thomas Henlich <thenlich at users dot sourceforge.net> 2011-04-25 08:46:38 UTC ---
(In reply to comment #5)
> On 04/23/2011 02:27 PM, jvdelisle at gcc dot gnu.org wrote:
> --- snip ---
> >
> > Unpatched gfortran and ifort give:
> 
> I meant patched gfortran and ifort give:
> >
> > 12345678901234567890
> >     0.100
> >      1.00
> >      10.0
> >      100.
> >     0.100E+00004
> >     0.100E+00005
> >     0.100E+00006
> >     0.100E+00007
> >     0.100E+00008
> >     0.100E+00009
> >     0.100E+00010
> >     0.100E+00011
> >     0.100E+00012
> --- snip ---
> >
> > My question, are the values of 1.0, 10.0, and 100. formatted correctly?
> >

Yes, the number of spaces is e+2=7, so they are aligned correctly.


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

* [Bug libfortran/48684] Incorrect field alignment with Gw.dEe descriptor
  2011-04-19 14:11 [Bug libfortran/48684] New: Incorrect field alignment with Gw.dEe descriptor thenlich at users dot sourceforge.net
                   ` (5 preceding siblings ...)
  2011-04-25  8:47 ` thenlich at users dot sourceforge.net
@ 2011-04-29 14:57 ` jvdelisle at gcc dot gnu.org
  2011-04-29 15:13 ` jvdelisle at gcc dot gnu.org
  2011-05-02 11:48 ` thenlich at users dot sourceforge.net
  8 siblings, 0 replies; 10+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2011-04-29 14:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> 2011-04-29 14:56:08 UTC ---
Author: jvdelisle
Date: Fri Apr 29 14:56:02 2011
New Revision: 173166

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=173166
Log:
2011-04-29  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
        Janne Blomqvist  <jb@gcc.gnu.org>

    PR libgfortran/48488
    PR libgfortran/48602
    PR libgfortran/48615
    PR libgfortran/48684
    PR libgfortran/48787
    * io/write.c (write_d, write_e, write_f, write_en,
    write_es): Add precision compemsation parameter to call.
    (set_fnode_default): Adjust default widths to assure
    round trip on write and read. (write_real): Adjust call to write_float.
    (write_real_g0): Calculate compensation for extra precision and adjust
    call to write_float. 
    * io/write_float.def (output_float_FMT_G_): Use volatile rather than
    asm volatile to avoid optimization issue. Correctly calculate the
    number of blanks (nb) to be appended and simplify calculation logic.
    (write_float): Increase MIN_FIELD_WIDTH by one to accomodate the new
    default widths. Eliminate the code that attempted to reduce the
    the precision used in later sprintf functions.  Add call parameter to
    compensate for extra precision.

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


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

* [Bug libfortran/48684] Incorrect field alignment with Gw.dEe descriptor
  2011-04-19 14:11 [Bug libfortran/48684] New: Incorrect field alignment with Gw.dEe descriptor thenlich at users dot sourceforge.net
                   ` (6 preceding siblings ...)
  2011-04-29 14:57 ` jvdelisle at gcc dot gnu.org
@ 2011-04-29 15:13 ` jvdelisle at gcc dot gnu.org
  2011-05-02 11:48 ` thenlich at users dot sourceforge.net
  8 siblings, 0 replies; 10+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2011-04-29 15:13 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> 2011-04-29 15:09:03 UTC ---
Author: jvdelisle
Date: Fri Apr 29 15:08:57 2011
New Revision: 173168

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

    PR libgfortran/48488
    PR libgfortran/48602
    PR libgfortran/48615
    PR libgfortran/48684
    PR libgfortran/48787
    * gfortran.dg/fmt_g.f: Adjust test.
    * gfortran.dg/fmt_g0_1.f08: Adjust test.
    * gfortran.dg/round_3.f08: New test.
    * gfortran.dg/namelist_print_1.f: Adjust test.
    * gfortran.dg/char4_iunit_1.f03: Adjust test.
    * gfortran.dg/f2003_io_5.f03: Adjust test.
    * gfortran.dg/coarray_15.f90: Adjust test.
    * gfortran.dg/namelist_65.f90: Adjust test.
    * gfortran.dg/fmt_cache_1.f: Adjust test.
    * gfortran.dg/char4_iunit_2.f03: Adjust test.
    * gfortran.dg/real_const_3.f90: Adjust test.

Added:
    trunk/gcc/testsuite/gfortran.dg/round_3.f08
Modified:
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gfortran.dg/char4_iunit_1.f03
    trunk/gcc/testsuite/gfortran.dg/char4_iunit_2.f03
    trunk/gcc/testsuite/gfortran.dg/coarray_15.f90
    trunk/gcc/testsuite/gfortran.dg/f2003_io_5.f03
    trunk/gcc/testsuite/gfortran.dg/fmt_cache_1.f
    trunk/gcc/testsuite/gfortran.dg/fmt_g.f
    trunk/gcc/testsuite/gfortran.dg/fmt_g0_1.f08
    trunk/gcc/testsuite/gfortran.dg/namelist_65.f90
    trunk/gcc/testsuite/gfortran.dg/namelist_print_1.f
    trunk/gcc/testsuite/gfortran.dg/real_const_3.f90


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

* [Bug libfortran/48684] Incorrect field alignment with Gw.dEe descriptor
  2011-04-19 14:11 [Bug libfortran/48684] New: Incorrect field alignment with Gw.dEe descriptor thenlich at users dot sourceforge.net
                   ` (7 preceding siblings ...)
  2011-04-29 15:13 ` jvdelisle at gcc dot gnu.org
@ 2011-05-02 11:48 ` thenlich at users dot sourceforge.net
  8 siblings, 0 replies; 10+ messages in thread
From: thenlich at users dot sourceforge.net @ 2011-05-02 11:48 UTC (permalink / raw)
  To: gcc-bugs

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

Thomas Henlich <thenlich at users dot sourceforge.net> changed:

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

--- Comment #9 from Thomas Henlich <thenlich at users dot sourceforge.net> 2011-05-02 11:38:55 UTC ---
The correct format according to Fortran 2008 is now used.


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

end of thread, other threads:[~2011-05-02 11:48 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-19 14:11 [Bug libfortran/48684] New: Incorrect field alignment with Gw.dEe descriptor thenlich at users dot sourceforge.net
2011-04-19 14:14 ` [Bug libfortran/48684] " burnus at gcc dot gnu.org
2011-04-19 14:59 ` thenlich at users dot sourceforge.net
2011-04-20  3:36 ` jvdelisle at gcc dot gnu.org
2011-04-23 21:28 ` jvdelisle at gcc dot gnu.org
2011-04-23 21:51 ` jvdelisle at frontier dot com
2011-04-25  8:47 ` thenlich at users dot sourceforge.net
2011-04-29 14:57 ` jvdelisle at gcc dot gnu.org
2011-04-29 15:13 ` jvdelisle at gcc dot gnu.org
2011-05-02 11:48 ` thenlich at users dot sourceforge.net

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