GCC Bugzilla has been upgraded from version 4.4.9 to 5.0rc3. If you see any problem, please report it to bug 64968.
Bug 25425 - [4.1 only] F95 and F2003 differ on list-directed output for 0.0
Summary: [4.1 only] F95 and F2003 differ on list-directed output for 0.0
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: libfortran (show other bugs)
Version: 4.2.0
: P3 normal
Target Milestone: 4.1.0
Assignee: Francois-Xavier Coudert
URL: http://gcc.gnu.org/ml/fortran/2006-02...
Keywords: patch
Depends on:
Blocks: 20585
  Show dependency treegraph
 
Reported: 2005-12-15 09:13 UTC by Francois-Xavier Coudert
Modified: 2006-02-14 14:52 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2006-01-29 22:06:15


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Francois-Xavier Coudert 2005-12-15 09:13:18 UTC
It seems that, according to F95, list-directed formatting of zero must behave as if formatted with the E descriptor (0.0E+00) while F2003 requires an F format behaviour (0.0). See message <1134632379.672465.126120@z14g2000cwz.googlegroups.com> on comp.lang.fortran ("writing formatted zeros with implicit formats", by robert.corbett@sun.com).

We currently implement the F2003 behaviour, independently of the -std flag.

$ cat a.f
      PROGRAM MAIN
        PRINT *, -2.1, -1.2, 0.0, 1.1, 2.2
      END
$ gfortran a.f && ./a.out
  -2.100000      -1.200000       0.000000       1.100000       2.200000    
$ ifort a.f && ./a.out
  -2.100000      -1.200000      0.0000000E+00   1.100000       2.200000
Comment 1 Andrew Pinski 2006-01-10 04:35:27 UTC
Confirmed.
Comment 2 Jerry DeLisle 2006-01-29 22:06:15 UTC
I will start on this.
Comment 3 Francois-Xavier Coudert 2006-02-06 21:31:44 UTC
Sorry to interfere, Jerry, but I had some time and decided to write that patch. If you already had a patch for this, I'd be interested in knowing the approach you chose.
Comment 4 Jerry DeLisle 2006-02-07 05:46:06 UTC
(In reply to comment #3)
> Sorry to interfere, Jerry, but I had some time and decided to write that patch.
> If you already had a patch for this, I'd be interested in knowing the approach
> you chose.
> 
Not a problem, I only had a first look at this and calculate G format caught my attention, that was as far as I got.  I was going to have to study the -std flag stuff to see where to go there.  Glad to see you in action!
Comment 5 Francois-Xavier Coudert 2006-02-08 20:54:18 UTC
Subject: Bug 25425

Author: fxcoudert
Date: Wed Feb  8 20:54:14 2006
New Revision: 110769

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=110769
Log:
	PR libfortran/25425

	* trans-decl.c (gfc_generate_function_code): Add new argument,
	pedantic, to set_std call.

	* libgfortran.h: Add pedantic field to compile_options struct.
	* io/write.c (calculate_G_format): Depending on the standard,
	choose E or F format for list-directed output of 0.0.
	* runtime/error.c (notify_std): Make warning and error dependent
	on pedanticity.
	* runtime/compile_options.c (set_std): Use new pedantic argument.

Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/trans-decl.c
    trunk/libgfortran/ChangeLog
    trunk/libgfortran/io/write.c
    trunk/libgfortran/libgfortran.h
    trunk/libgfortran/runtime/compile_options.c
    trunk/libgfortran/runtime/error.c

Comment 6 Francois-Xavier Coudert 2006-02-14 14:50:43 UTC
Subject: Bug 25425

Author: fxcoudert
Date: Tue Feb 14 14:50:40 2006
New Revision: 110973

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=110973
Log:
	PR libfortran/25425

	* trans-decl.c (gfc_generate_function_code): Add new argument,
	pedantic, to set_std call.

	* libgfortran.h: Add pedantic field to compile_options struct.
	* io/write.c (calculate_G_format): Depending on the standard,
	choose E or F format for list-directed output of 0.0.
	* runtime/error.c (notify_std): Make warning and error dependent
	on pedanticity.
	* runtime/compile_options.c (set_std): Use new pedantic argument.

Modified:
    branches/gcc-4_1-branch/gcc/fortran/ChangeLog
    branches/gcc-4_1-branch/gcc/fortran/trans-decl.c
    branches/gcc-4_1-branch/libgfortran/ChangeLog
    branches/gcc-4_1-branch/libgfortran/io/write.c
    branches/gcc-4_1-branch/libgfortran/libgfortran.h
    branches/gcc-4_1-branch/libgfortran/runtime/compile_options.c
    branches/gcc-4_1-branch/libgfortran/runtime/error.c

Comment 7 Francois-Xavier Coudert 2006-02-14 14:52:14 UTC
Fixed on 4.2 and 4.1.