https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103560
--- Comment #6 from brocolis at eml dot cc --- (In reply to Andrew Pinski from comment #4) > > f951.exe: Error: Nonexistent include directory './' > > Hmm, that seems wrong. the directory ./ definitely exists as it is the > current working directory. > > Are you building on a mounted drive or a local disk? I'm building on a local disk. This patch works for me on Windows/mingw - applied on top of git-master commit https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=641ff2196fe3909bba852a5ac1d55e7cdab6d361 diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c index 7b98ba539d6..a4a21082366 100644 --- a/gcc/fortran/module.c +++ b/gcc/fortran/module.c @@ -1095,8 +1095,9 @@ gzopen_included_file_1 (const char *name, gfc_directorylist *list, if (module && !p->use_for_modules) continue; - fullname = (char *) alloca(strlen (p->path) + strlen (name) + 1); + fullname = (char *) alloca(strlen (p->path) + strlen (name) + 2); strcpy (fullname, p->path); + strcat (fullname, "/"); strcat (fullname, name); f = gzopen (fullname, "r"); diff --git a/gcc/fortran/scanner.c b/gcc/fortran/scanner.c index 4d72ff78543..f1a6cd9ad21 100644 --- a/gcc/fortran/scanner.c +++ b/gcc/fortran/scanner.c @@ -409,9 +409,8 @@ add_path_to_list (gfc_directorylist **list, const char *path, *list = dir; dir->use_for_modules = use_for_modules; dir->warn = warn; - dir->path = XCNEWVEC (char, strlen (p) + 2); + dir->path = XCNEWVEC (char, strlen (p) + 1); strcpy (dir->path, p); - strcat (dir->path, "/"); /* make '/' last character */ } /* defer_warn is set to true while parsing the commandline. */ @@ -476,8 +475,9 @@ open_included_file (const char *name, gfc_directorylist *list, if (module && !p->use_for_modules) continue; - fullname = (char *) alloca(strlen (p->path) + strlen (name) + 1); + fullname = (char *) alloca(strlen (p->path) + strlen (name) + 2); strcpy (fullname, p->path); + strcat (fullname, "/"); strcat (fullname, name); f = gfc_open_file (fullname);