Bug 42848 - compiler crashes and asks for this bug report
Summary: compiler crashes and asks for this bug report
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.4.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-01-22 16:41 UTC by frank.braun
Modified: 2010-09-10 21:08 UTC (History)
2 users (show)

See Also:
Host: Dell Intel Windows Mingwin MSYS
Target: Dell Intel Windows Mingwin MSYS
Build: MSYS full with gcc g++ and gfortran
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description frank.braun 2010-01-22 16:41:53 UTC
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&#9500;ñ&#9500;ƒ 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
Comment 1 Tobias Burnus 2010-01-22 17:44:29 UTC
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.
Comment 2 Toon Moene 2010-01-23 13:24:50 UTC
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.
Comment 3 frank.braun 2010-01-25 07:57:38 UTC
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.
> 

Comment 4 Tobias Burnus 2010-01-25 08:30:30 UTC
(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.)
Comment 5 frank.braun 2010-01-25 08:36:35 UTC
'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?
Comment 6 Daniel Franke 2010-04-30 22:13:53 UTC
(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?
Comment 7 Francois-Xavier Coudert 2010-09-10 21:08:53 UTC
Closing, please reopen with additional information if the problem persists with a more recent version of the compiler (>= 4.5.0). Thanks!