This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libfortran/51407] New: Use of BOZ edit descriptors to edit real and complex data and F2008
- From: "dominiq at lps dot ens.fr" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 04 Dec 2011 12:40:51 +0000
- Subject: [Bug libfortran/51407] New: Use of BOZ edit descriptors to edit real and complex data and F2008
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51407
Bug #: 51407
Summary: Use of BOZ edit descriptors to edit real and complex
data and F2008
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libfortran
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: dominiq@lps.ens.fr
CC: burnus@net-b.de, jvdelisle@gcc.gnu.org,
thenlich@users.sourceforge.net
Consider the following code (borrowed from Iain Sandoe):
real(kind=16) :: x
character(len=32) :: str1
x = 1.0_16 + 2.0_16**(-105)
write (str1,'(z32)') x
print *, str1
end
Without any -std=xx the executable outputs (on x86_64-apple-darwin10):
3FFF0000000000000000000000000080
With -std=xx, xx in f95, f2003, and f2008, it ouputs
At line 4 of file boz_real.f90
Fortran runtime error: Expected INTEGER for item 1 in formatted transfer, got
REAL
(z32)
^
Altough the standards state
10.5.1 Numeric editing
The I, B, O, Z, F, E, EN, ES, D, and G edit descriptors may be used to specify
the input/output of integer, real, and complex data. The following general
rules apply:
I think the use of BOZ edit descriptors to edit real and complex data is
implicitly forbidden in f95 and f2003 by (f95)
10.5.1.2 Real and complex editing
The F, E, EN, ES, and D edit descriptors specify the editing of real and
complex data. An input/output list item corresponding to an F, E, EN, ES, or D
edit descriptor shall be real or complex. The G edit descriptor also may be
used to edit real and complex data (10.5.4.1.2).
or (f2003)
10.6.1.2 Real and complex editing
The F, E, EN, ES, and D edit descriptors specify the editing of real and
complex data. An input/output list item corresponding to an F, E, EN, ES, or D
edit descriptor shall be real or complex. The G edit descriptor also may be
used to edit real and complex data (10.6.4.1.2).
but explicitly allowed in f2008 by
10.7.2.3.1 General
The F, E, EN, ES, and D edit descriptors specify the editing of real and
complex data. An input/output list item corresponding to an F, E, EN, ES, or D
edit descriptor shall be real or complex. The G, B, O, and Z edit descriptors
also may be used to edit real and complex data (10.7.5.2.2, 10.7.2.4).
Is this reading of the standards correct?