[Bug fortran/47296] I/O Segfault when running out of file descriptors

jb at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sat Jan 15 10:49:00 GMT 2011


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

Janne Blomqvist <jb at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jb at gcc dot gnu.org

--- Comment #5 from Janne Blomqvist <jb at gcc dot gnu.org> 2011-01-15 09:18:18 UTC ---
Nice catch.

Looking at the code, when creating a SCRATCH file fails, unix.c:tempfile()
returns -1, then as a result open_external() returns NULL, but then in
open.c:new_unit() even though we have checked that open_external() returns
NULL, we still call unpack_filename(), as well as accessing opp->file_len.

Just to be sure, I suspect it would be prudent to set opp->file to NULL and
opp->file_len to 0 in tempfile() in case fd < 0. Or are we sure that the entire
opp struct is set to 0 sometime before?



More information about the Gcc-bugs mailing list