public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/40195]  New: ICE when compiling a file located in another directory
@ 2009-05-19 11:08 francois dot jacq at irsn dot fr
  2009-05-21  9:13 ` [Bug fortran/40195] " fxcoudert at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: francois dot jacq at irsn dot fr @ 2009-05-19 11:08 UTC (permalink / raw)
  To: gcc-bugs

D:\test\bin>gfortran -c ..\source\t2.f90
Fatal Error: Can't delete module file 'm.mod': Permission denied
gfortran: Internal error: Aborted (program f951)
Please submit a full bug report.
See <http://gcc.gnu.org.bugs.html> for instructions.

File ..\source\t2.f90 :

MODULE m
END MODULE


-- 
           Summary: ICE when compiling a file located in another directory
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: francois dot jacq at irsn dot fr
 GCC build triplet: 20090421 (experimental) [trunk revision 146519]
  GCC host triplet: Window XP i386 MinGW
GCC target triplet: GNU Fortran (GCC) 4.5.0


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


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

* [Bug fortran/40195] ICE when compiling a file located in another directory
  2009-05-19 11:08 [Bug fortran/40195] New: ICE when compiling a file located in another directory francois dot jacq at irsn dot fr
@ 2009-05-21  9:13 ` fxcoudert at gcc dot gnu dot org
  2009-05-21 18:27 ` francois dot jacq at irsn dot fr
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2009-05-21  9:13 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from fxcoudert at gcc dot gnu dot org  2009-05-21 09:12 -------
It works for me. This sounds like the issue you'd have if you didn't have write
permission to the current directory.

 What are the permissions and ownership of the bin and source directories? What
user is trying to compile?


-- 


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


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

* [Bug fortran/40195] ICE when compiling a file located in another directory
  2009-05-19 11:08 [Bug fortran/40195] New: ICE when compiling a file located in another directory francois dot jacq at irsn dot fr
  2009-05-21  9:13 ` [Bug fortran/40195] " fxcoudert at gcc dot gnu dot org
@ 2009-05-21 18:27 ` francois dot jacq at irsn dot fr
  2009-05-21 20:52 ` fxcoudert at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: francois dot jacq at irsn dot fr @ 2009-05-21 18:27 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from francois dot jacq at irsn dot fr  2009-05-21 18:27 -------
(In reply to comment #1)
> It works for me. This sounds like the issue you'd have if you didn't have write
> permission to the current directory.

I have all the permissions to that directory. The same command with g95 or
gfortran-4.3.3 works perfectly. 

Anyway, the compiler itself issued an ICE message ... and this is not normal !

I also got a similar trouble ("Can't delete the module file m.mod")  with the
binary package provided by www.equation.com (gcc-4.5 20090514), but without the
ICE message !

> 
>  What are the permissions and ownership of the bin and source directories? What
> user is trying to compile?

I have all the privileges. I created myself the directory tree d:\test\bin and
d:\test\source\t2.f90 because I met this trouble when installing a much more
complicated software. So I decided to create a simple test cases to try and
reproduce the problem.

However, your remark lead me to the right explanation : the problem is not due
to a change of directory as I suggested initially, but simply to the fact that
a file "m.mod", created by another compiler, was already located in the "bin"
directory !

For instance, in the directory d:\source :

d:\test\source>gfortran -c t2.f90
d:\test\source>g95 -c t2.f90
d:\test\source>gfortran -c t2.f90
Fatal Error: Can't delete module file 'm.mod': Permission denied
d:\test\source> del m.mod
d:\test\source>gfortran -c t2.f90

As you see, the first and third gfortran commands work well but not the second
one because of the presence of the g95 module. Notice that this second
instruction did not issue the ICE message because I was testing again the
"equations" package gcc-4.5-200090514.


-- 


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


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

* [Bug fortran/40195] ICE when compiling a file located in another directory
  2009-05-19 11:08 [Bug fortran/40195] New: ICE when compiling a file located in another directory francois dot jacq at irsn dot fr
  2009-05-21  9:13 ` [Bug fortran/40195] " fxcoudert at gcc dot gnu dot org
  2009-05-21 18:27 ` francois dot jacq at irsn dot fr
@ 2009-05-21 20:52 ` fxcoudert at gcc dot gnu dot org
  2009-05-22  7:04 ` [Bug fortran/40195] Cannot unlink existing module file fxcoudert at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2009-05-21 20:52 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from fxcoudert at gcc dot gnu dot org  2009-05-21 20:52 -------
Thanks for your comments! With such a clear description, it was now easy to
find the issue: 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. The patch below fixes it (built and tested on i386-pc-mingw32):


Index: module.c
===================================================================
--- module.c    (revision 147744)
+++ module.c    (working copy)
@@ -4759,7 +4759,7 @@ read_md5_from_module_file (const char * 
   if ((file = fopen (filename, "r")) == NULL)
     return -1;

-  /* Read two lines.  */
+  /* Read the first line.  */
   if (fgets (buf, sizeof (buf) - 1, file) == NULL)
     {
       fclose (file);
@@ -4769,8 +4769,12 @@ read_md5_from_module_file (const char * 
   /* The file also needs to be overwritten if the version number changed.  */
   n = strlen ("GFORTRAN module version '" MOD_VERSION "' created");
   if (strncmp (buf, "GFORTRAN module version '" MOD_VERSION "' created", n) !=
0)
-    return -1;
+    {
+      fclose (file);
+      return -1;
+    }

+  /* Read a second line.  */
   if (fgets (buf, sizeof (buf) - 1, file) == NULL)
     {
       fclose (file);



(PS: the fields "host", "target" and "build" in GCC bugzilla refer to three
target triplets: "host" is the architecture the compiler runs on, "target" is
the one it generates code for, and "build" is the architecture that was used to
compile the compiler itself. In your case, you have host = target = build =
i386-pc-mingw32.)


-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |fxcoudert at gcc dot gnu dot
                   |dot org                     |org
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
  GCC build triplet|20090421 (experimental)     |
                   |[trunk revision 146519]     |
   GCC host triplet|Window XP i386 MinGW        |
 GCC target triplet|GNU Fortran (GCC) 4.5.0     |i386-pc-mingw32
           Keywords|                            |patch
   Last reconfirmed|0000-00-00 00:00:00         |2009-05-21 20:52:47
               date|                            |


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


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

* [Bug fortran/40195] Cannot unlink existing module file
  2009-05-19 11:08 [Bug fortran/40195] New: ICE when compiling a file located in another directory francois dot jacq at irsn dot fr
                   ` (2 preceding siblings ...)
  2009-05-21 20:52 ` fxcoudert at gcc dot gnu dot org
@ 2009-05-22  7:04 ` fxcoudert at gcc dot gnu dot org
  2009-05-22 12:54 ` fxcoudert at gcc dot gnu dot org
  2009-05-22 12:55 ` fxcoudert at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2009-05-22  7:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from fxcoudert at gcc dot gnu dot org  2009-05-22 07:04 -------
Subject: Bug 40195

Author: fxcoudert
Date: Fri May 22 07:04:09 2009
New Revision: 147793

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=147793
Log:
        PR fortran/40195
        * module.c (read_md5_from_module_file): Close file before returning.

Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/module.c


-- 


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


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

* [Bug fortran/40195] Cannot unlink existing module file
  2009-05-19 11:08 [Bug fortran/40195] New: ICE when compiling a file located in another directory francois dot jacq at irsn dot fr
                   ` (3 preceding siblings ...)
  2009-05-22  7:04 ` [Bug fortran/40195] Cannot unlink existing module file fxcoudert at gcc dot gnu dot org
@ 2009-05-22 12:54 ` fxcoudert at gcc dot gnu dot org
  2009-05-22 12:55 ` fxcoudert at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2009-05-22 12:54 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from fxcoudert at gcc dot gnu dot org  2009-05-22 12:54 -------
Subject: Bug 40195

Author: fxcoudert
Date: Fri May 22 12:54:23 2009
New Revision: 147796

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=147796
Log:
        PR fortran/40195
        * module.c (read_md5_from_module_file): Close file before returning.

Modified:
    branches/gcc-4_4-branch/gcc/fortran/ChangeLog
    branches/gcc-4_4-branch/gcc/fortran/module.c


-- 


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


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

* [Bug fortran/40195] Cannot unlink existing module file
  2009-05-19 11:08 [Bug fortran/40195] New: ICE when compiling a file located in another directory francois dot jacq at irsn dot fr
                   ` (4 preceding siblings ...)
  2009-05-22 12:54 ` fxcoudert at gcc dot gnu dot org
@ 2009-05-22 12:55 ` fxcoudert at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2009-05-22 12:55 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from fxcoudert at gcc dot gnu dot org  2009-05-22 12:55 -------
Fixed on trunk and 4.4 branch.


-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.4.1


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


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

end of thread, other threads:[~2009-05-22 12:55 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-19 11:08 [Bug fortran/40195] New: ICE when compiling a file located in another directory francois dot jacq at irsn dot fr
2009-05-21  9:13 ` [Bug fortran/40195] " fxcoudert at gcc dot gnu dot org
2009-05-21 18:27 ` francois dot jacq at irsn dot fr
2009-05-21 20:52 ` fxcoudert at gcc dot gnu dot org
2009-05-22  7:04 ` [Bug fortran/40195] Cannot unlink existing module file fxcoudert at gcc dot gnu dot org
2009-05-22 12:54 ` fxcoudert at gcc dot gnu dot org
2009-05-22 12:55 ` fxcoudert 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).