[Bug fortran/40195] ICE when compiling a file located in another directory
fxcoudert at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Thu May 21 20:52:00 GMT 2009
------- 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
More information about the Gcc-bugs
mailing list