[Bug fortran/38382] Open(Unit=6 fails

2008-12-05 Thread jvdelisle at gcc dot gnu dot org


--- Comment #3 from jvdelisle at gcc dot gnu dot org  2008-12-06 04:34 
---
Closing, I do not consider this a bug for reasons stated in comment #1


-- 

jvdelisle at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution||INVALID


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



[Bug fortran/38382] Open(Unit=6 fails

2008-12-03 Thread dominiq at lps dot ens dot fr


--- Comment #2 from dominiq at lps dot ens dot fr  2008-12-03 17:03 ---
Is not this pr a duplicate of an older one?


-- 


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



[Bug fortran/38382] Open(Unit=6 fails

2008-12-03 Thread burnus at gcc dot gnu dot org


--- Comment #1 from burnus at gcc dot gnu dot org  2008-12-03 16:49 ---
If you write:

   OPEN(UNIT=OUTPUT_UNIT, FILE="foo.dat")

then you want that all output to the OUTPUT_UNIT is written to the file
"foo.dat". And a asterix UNIT=* in a PRINT or WRITE statement denotes the
OUTPUT_UNIT.

In many compilers, including gfortran, the standard output is unit 6, the
standard error output is 0 (ERROR_UNIT) and the standard input unit is 5 (=
INPUT_UNIT).

(The constants such as OUTPUT_UNIT are defined in the intrinsic module
"ISO_FORTRAN_ENV".)

As a general advise, you should try not to use unit numbers smaller than 10 as
some of them are likely to have a special meaning, depending on the compiler;
especially the numbers 0, 5, 6 should be avoided (unless you want to redirect
stdin/stderr/stdout).

If a compiler prints "Hello" to the screen for the following program, it is
invalid according to the Fortran 2003 standard, previous Fortran standard have
not specified this.

use iso_fortran_env  ! Needs a (partially) Fortran 2003 supporting compiler
open(unit=OUTPUT_UNIT, file="foo.txt")
print *, "Hello"
end


-- 


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