public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/31053]  New: print file name when file cannot be opened for writing
@ 2007-03-05 22:28 vivekrao4 at yahoo dot com
  2007-03-06 19:33 ` [Bug fortran/31053] " tkoenig at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: vivekrao4 at yahoo dot com @ 2007-03-05 22:28 UTC (permalink / raw)
  To: gcc-bugs

On Windows, if a file is open in Excel, one cannot write to it in a Fortran
program. So if "junk.csv" is opened in Excel and I compile and run the code

program xopen
! check what happens when program tries to open file already open
implicit none
integer, parameter :: iu = 20
character (len=*), parameter :: xfile="junk.csv"
open (unit=iu,file=xfile,action="write",status="replace")
end program xopen

gfortran
Target: i386-pc-mingw32
Configured with: ../trunk/configure --prefix=/mingw
--enable-languages=c,fortran --with-gmp=/home/coudert/local --disable-nls
--with-ld=/mingw/bin/ld --with-as=/mingw/bin/as --disable-werror
--enable-bootstrap --enable-threads --host=i386-pc-mingw32 --disable-shared
--enable-libgomp
Thread model: win32
gcc version 4.3.0 20061021 (experimental)

says

At line 6 of file xopen_error.f90
Fortran runtime error: Permission denied

I'd like it to say that file "junk.csv" could not be opened, to make debugging
easier for the user. For example, Intel Visual Fortran says

forrtl: The process cannot access the file because it is being used by another
process.
forrtl: severe (30): open failure, unit 20, file U:\vrao\fortran\junk.csv
Image              PC        Routine            Line        Source             
ifort_xopen_error  0044382E  Unknown               Unknown  Unknown
ifort_xopen_error  00440AEC  Unknown               Unknown  Unknown
ifort_xopen_error  00405DFA  Unknown               Unknown  Unknown
ifort_xopen_error  00405A17  Unknown               Unknown  Unknown
ifort_xopen_error  00401C81  Unknown               Unknown  Unknown
ifort_xopen_error  0040106F  _MAIN__                     6  xopen_error.f90
ifort_xopen_error  00449970  Unknown               Unknown  Unknown
ifort_xopen_error  0042EBB8  Unknown               Unknown  Unknown
kernel32.dll       7C816FD7  Unknown               Unknown  Unknown


-- 
           Summary: print file name when file cannot be opened for writing
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: vivekrao4 at yahoo dot com


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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug fortran/31053] print file name when file cannot be opened for writing
  2007-03-05 22:28 [Bug fortran/31053] New: print file name when file cannot be opened for writing vivekrao4 at yahoo dot com
@ 2007-03-06 19:33 ` tkoenig at gcc dot gnu dot org
  2007-03-07  7:18 ` burnus at gcc dot gnu dot org
  2007-03-07 14:24 ` tkoenig at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2007-03-06 19:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from tkoenig at gcc dot gnu dot org  2007-03-06 19:32 -------
Yes, this would be useful.

Confirmed.


-- 

tkoenig at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tkoenig at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2007-03-06 19:32:57
               date|                            |


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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug fortran/31053] print file name when file cannot be opened for writing
  2007-03-05 22:28 [Bug fortran/31053] New: print file name when file cannot be opened for writing vivekrao4 at yahoo dot com
  2007-03-06 19:33 ` [Bug fortran/31053] " tkoenig at gcc dot gnu dot org
@ 2007-03-07  7:18 ` burnus at gcc dot gnu dot org
  2007-03-07 14:24 ` tkoenig at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-03-07  7:18 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from burnus at gcc dot gnu dot org  2007-03-07 07:17 -------
> gcc version 4.3.0 20061021 (experimental)

I believe this has been fixed already by PR30005 since December 5.

At least my gfortran prints:

At line 6 of file foo.f90
Fortran runtime error: Permission denied trying to open file 'junk.csv'


-- 


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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug fortran/31053] print file name when file cannot be opened for writing
  2007-03-05 22:28 [Bug fortran/31053] New: print file name when file cannot be opened for writing vivekrao4 at yahoo dot com
  2007-03-06 19:33 ` [Bug fortran/31053] " tkoenig at gcc dot gnu dot org
  2007-03-07  7:18 ` burnus at gcc dot gnu dot org
@ 2007-03-07 14:24 ` tkoenig at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2007-03-07 14:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from tkoenig at gcc dot gnu dot org  2007-03-07 14:24 -------
(In reply to comment #2)

> I believe this has been fixed already by PR30005 since December 5.

Correct.  The fix isn't in 4.2 though (which is what I tried :-)

Closing as a duplicate of 30005.


*** This bug has been marked as a duplicate of 30005 ***


-- 

tkoenig at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
      Known to fail|                            |4.2.0
      Known to work|                            |4.3.0
         Resolution|                            |DUPLICATE


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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-03-07 14:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-05 22:28 [Bug fortran/31053] New: print file name when file cannot be opened for writing vivekrao4 at yahoo dot com
2007-03-06 19:33 ` [Bug fortran/31053] " tkoenig at gcc dot gnu dot org
2007-03-07  7:18 ` burnus at gcc dot gnu dot org
2007-03-07 14:24 ` tkoenig at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).