Compiling a file with -c option (no exec)with gfortran lets the compiler output an internal error message. The file: ! Demoprogramm: ! Aufrufen einer C-Routine von Fortran aus ! Die C-Routine wird innerhalb eines Modules deklariert module cproc interface ! definierte Schnittstelle subroutine pythagoras (a, b, res) !DEC$ ATTRIBUTES C :: pythagoras !DEC$ ATTRIBUTES REFERENCE :: res real :: a, b, res end subroutine end interface end module program fmain use cproc implicit none real :: x, y, z write(*,*) ' Berechnung der Hypotenusenlaenge eines rechtwickligen Dreie cks' write(*,*) ' Geben Sie die beiden Seitenlaengen ein, die den rechten Win kel' write(*,*) ' einschliessen:' read(*,*) x, y call pythagoras(x,y,z) write(*,*) ' Die Laenge der Hypotenuse betraegt: ', z end program fmain The error message (translated by hand to english): Administrator@PC55556 /c/vectra/fortran $ gfortran -c fmain.f90 Unrecoverable error: Can't delete module file 'cproc.mod': Permission denied gfortran.exe: Onternal error: Aborted (program f951) Please send a complete error report in english ... Administrator@PC55556 /c/vectra/fortran $ gfortran -v Target: mingw32 Configured with: ../gcc-4.4.0/configure --enable-languages=c,ada,c++,fortran,ja va,objc,obj-c++ --disable-sjlj-exceptions --enable-shared --enable-libgcj --enab le-libgomp --with-dwarf2 --disable-win32-registry --enable-libstdcxx-debug --ena ble-version-specific-runtime-libs --prefix=/mingw --with-gmp=/mingw/src/gmp/root --with-mpfr=/mingw/src/mpfr/root --build=mingw32 Thread-Modell: win32 gcc-Version 4.4.0 (GCC) Administrator@PC55556 /c/vectra/fortran The error message (original as it appeared on the screen): Administrator@PC55556 /c/vectra/fortran $ gfortran -c fmain.f90 Schwerwiegender Fehler: Can't delete module file 'cproc.mod': Permission denied gfortran.exe: Interner Fehler: Aborted (Programm f951) Bitte senden Sie einen vollständigen Fehlerbericht auf Englisch ein; Fehler in der deutschen Übersetzung sind an translation-team-de@lists.sourceforge.net zu melden. Gehen Sie gemäß den Hinweisen in <http://gcc.gnu.org/bugs.html> vor. Administrator@PC55556 /c/vectra/fortran $ gfortran -v Es werden eingebaute Spezifikationen verwendet. Ziel: mingw32 Konfiguriert mit: ../gcc-4.4.0/configure --enable-languages=c,ada,c++,fortran,ja va,objc,obj-c++ --disable-sjlj-exceptions --enable-shared --enable-libgcj --enab le-libgomp --with-dwarf2 --disable-win32-registry --enable-libstdcxx-debug --ena ble-version-specific-runtime-libs --prefix=/mingw --with-gmp=/mingw/src/gmp/root --with-mpfr=/mingw/src/mpfr/root --build=mingw32 Thread-Modell: win32 gcc-Version 4.4.0 (GCC) Administrator@PC55556 /c/vectra/fortran
Thanks for the bug report. However, I think this a duplicate of PR 40195 which was fixed 2009-05-22. Thus, the solution is to use any GCC 4.4.x or 4.5.x newer than 22 May 2009 such as 4.4.1, 4.4.2, or 4.4.3 - or a recent 4.5 experimental version. Comment from the other bug report: "If a module file m.mod already exist, we look into it to check if it's ours; if not, we delete it and write ours. The problem is that the code doing that actually unlinks the file before closing it, which is not allowed on Windows" Thus, a work around is to delete the *.mod file(s) manually before instructing gfortran to (over)write it.
Tobias, If we ask a bug submitter for more information, or to confirm our suspicions, we put the bug report in WAITING. Note to submitter: bug reports with status WAITING will be closed if not replied to within 3 months. Kind regards.
Today I am not able to reproduce the error. The compiler is working. Where exactly does the file m.mod reside? In the user directory or in a compiler directory? Frank Braun (In reply to comment #2) > Tobias, > > If we ask a bug submitter for more information, or to confirm our suspicions, > we put the bug report in WAITING. > > Note to submitter: bug reports with status WAITING will be closed if not > replied to within 3 months. > > Kind regards. >
(In reply to comment #3) > Today I am not able to reproduce the error. The compiler is working. Where > exactly does the file m.mod reside? In the user directory or in a compiler > directory? By default in the current directory - unless you used the option -J<directory> to specify a different one. Note: In order to help writing makefiles which have dependencies on the .mod files, gfortran only overwrites the .mod files if they have changed. Thus, to reproduce the problem, you could compile the program with a different compiler or an older version of GCC - or simply create in any editor the .mod file. (Modifying the Fortran module + running gfortran also produces a new .mod file, but I think works also without the patch of PR 40195.)
've got it. Modifying the .mod file by hand makes the compiler crash. Deleting it lets it work correctly. The compiler shouldn't crash anyway. But with a new version this problem should be solved too, isn't it?
(In reply to comment #5) > The compiler shouldn't crash anyway. But with a new version this problem should > be solved too, isn't it? It should be. 4.5.0 was released by now. Could you check again?
Closing, please reopen with additional information if the problem persists with a more recent version of the compiler (>= 4.5.0). Thanks!