This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/34795] inquire statement , direct= specifier incorrectly returns YES
- From: "kendrick dot killian at colostate dot edu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 16 Jan 2008 00:50:00 -0000
- Subject: [Bug fortran/34795] inquire statement , direct= specifier incorrectly returns YES
- References: <bug-34795-15636@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #2 from kendrick dot killian at colostate dot edu 2008-01-16 00:50 -------
Subject: Re: inquire statement , direct= specifier incorrectly returns YES
There is a three part definition of correct answer that mirrors
arguments in the formatted/unformatted thread. Noting that the
standard, 9.6.1.9, requires that DIRECT answer based on the
"set of allowed access methods".
Condition 1. (NOT the reported bug)
inquire on a file NOT connected/opened INQUIRE(NAME=existing_file,...)
Unless the file system maintains access methods or the runtime library
has a documented way of determining those method, the correct answer is
"UNKNOWN" as you stated. Assuming that nothing STOPS you from doing a
direct open, YES might be acceptable but it is NOT the most informative
answer as YES makes an affirmative statement about the file rather than
indicating a lack of restriction.
Condition 2 (The bug reported)
inquire on a CONNECTED file INQUIRE(UNIT=...)
Accessing a sequential unit with direct IO or sequential IO on a unit
opened for direct access should be undefined and generate read errors.
Errors should be sufficient to determine a unit's "allowed access
methods".
Even if the implementation does not generate fatal errors, as possible
in the format/unformat discussion, then the data returned will be
corrupt.
Inquire (UNIT= should provide information needed to read/write the unit
**AS OPENED** without corruption.
Lastly
Gfortran's response to the inquire direct= is INCONSISTENT with the
response provided my other compilers. I tested
Absoft OS X FORTRAN 77/90/95 Compilers 7.0b, (c) 1987-2002, Absoft
Corp
SUN Sun WorkShop 6 update 1 Fortran 77/90/95 6.1 2000/09/11
COMPAQ Compaq Visual Fortran Standard Edition 6.5.0 (c) 2000
g77 version 3.0.4 (Fortran Frontend version 0.5.26 20020220
(release))
With all eight the above compilers, the test program returns:
default open drct=NO opened= T access=SEQUENTIAL
Sequent open drct=NO opened= T access=SEQUENTIAL
direct open drct=YES opened= T access=DIRECT
The common response, when consistent with the standard, is certainly the
preferred solution if not "correct" answer.
On Jan 15, 2008, at 12:12 PM, burnus at gcc dot gnu dot org wrote:
>
>
> ------- Comment #1 from burnus at gcc dot gnu dot org 2008-01-15
> 19:12 -------
> | correct output (produced by g77)
> | default open drct=NO opened= T access=SEQUENTIAL
> | Sequent open drct=NO opened= T access=SEQUENTIAL
> | direct open drct=YES opened= T access=DIRECT
>
> How do you know which answer is correct? I think this is the same
> problem as
> formatted and unformatted: The answers are only correct with a certain
> probability.
>
> One can even open an UNFORMATTED file as FORMATTED though reading
> probably
> produces only garbage.
>
> As starting point I would recommend to read:
> http://groups.google.com/group/comp.lang.fortran/msg/b2ab0a6e106d977c
> (and maybe also the complete thread).
>
> If you can then explain why a certain value is better than another,
> we might
> change it. (By the way, the only true answer is "UNKNOWN".)
>
>
> --
>
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34795
>
> ------- You are receiving this mail because: -------
> You reported the bug, or are watching the reporter.
>
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34795