https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67367
Bug ID: 67367 Summary: Program crashes on READ(IOSTAT=IOS, ...) on directory OPEN()ed without error Product: gcc Version: 4.9.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: urbanjost at comcast dot net Target Milestone: --- Created attachment 36257 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36257&action=edit commands and their output show system type, compiler version, source code and saved temp files When I read a list of filenames from the command line the list can easily contain non-standard-file names such as directories. If I OPEN() a name that is a directory with default options I get an error on the OPEN() (IOSTAT=21) and IOMSG reports "file is a directory". But I am opening the files as read-only streams. With those options the OPEN() gives no errors. But the first READ() of the files causes the program to halt abruptly with no messages. No core file is produced; I/O on open files is not flushed or closed properly. I would have expected the OPEN() to have failed with an error; or if it is legal to open a directory as a stream (which would be useful but surprising) I would expect the READ to have trapped the error as the READ() uses IOSTAT=.