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

--- Comment #3 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> 2011-01-15 
06:33:15 UTC ---
This is easy enough and if you study the code path, it makes sense.  The error
flag returned here is passed up the call chain where an "os" error is
generated. When attempting to open a temporary file, if the file open fails,
the file name in the opp structure is not set, so it is NULL. 

Index: unix.c
===================================================================
--- unix.c    (revision 168773)
+++ unix.c    (working copy)
@@ -1000,6 +1000,8 @@
 int
 unpack_filename (char *cstring, const char *fstring, int len)
 {
+  if (fstring == NULL)
+    return 1;
   len = fstrlen (fstring, len);
   if (len >= PATH_MAX)
     return 1;

The result:

At line 39 of file pr47296.f90 (unit = 27, file = '')
Fortran runtime error: Too many open files

I will commit this as obvious shortly if regression testing passes.  I can not
imagine it causing a problem.

In the meantime, I will see if i can test on a Windows based system, to see if
it works or if there is another issue.

Reply via email to