Found at http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/110fb27c70e1a193 Reported by: Philippe Bourdin
The following program always prints "-42" independent whether the file exists or not. It at least should initialize the variable by "-1". !------------------- integer :: i i = -42 inquire(file='test.dat', size=i) print *, i end !------------------- "9.9.1.29 SIZE= specifier in the INQUIRE statement" "The scalar-int-variable in the SIZE= specifier is assigned the size of the file in file storage units. If the file size cannot be determined, the variable is assigned the value -1. "For a file that may be connected for stream access, the file size is the number of the highest-numbered file storage unit in the file. For a file that may be connected for sequential or direct access, the file size may be different from the number of storage units implied by the data in the records; the exact relationship is processor-dependent." -- Summary: I/O: INQUIRE for SIZE does not work. Product: gcc Version: 4.5.0 Status: UNCONFIRMED Keywords: wrong-code Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: burnus at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43409