aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/module.cc
diff options
context:
space:
mode:
authorTobias Burnus <tobias@codesourcery.com>2022-03-23 16:54:12 +0100
committerTobias Burnus <tobias@codesourcery.com>2022-03-23 16:54:12 +0100
commit5e33fea21957c97d63e3738be6056ae2a94e3284 (patch)
tree66283c2f660e7acf4b529b2848716bac8a3db57a /gcc/fortran/module.cc
parentd9792f8d227cdd409c2b082ef0685b47ccfaa334 (diff)
downloadgcc-5e33fea21957c97d63e3738be6056ae2a94e3284.zip
gcc-5e33fea21957c97d63e3738be6056ae2a94e3284.tar.gz
gcc-5e33fea21957c97d63e3738be6056ae2a94e3284.tar.bz2
Fortran: Fix directory stat check for '.' [PR103560]
MinGW does not like a call to 'stat' for './' via gfc_do_check_include_dir. Solution: Only append '/' when concatenating the path with the filename. gcc/fortran/ChangeLog: PR fortran/103560 * scanner.cc (add_path_to_list): Don't append '/' to the save include path. (open_included_file): Use '/' in concatenating path + file name. * module.cc (gzopen_included_file_1): Likewise. gcc/testsuite/ChangeLog: PR fortran/103560 * gfortran.dg/include_14.f90: Update dg-warning. * gfortran.dg/include_17.f90: Likewise. * gfortran.dg/include_18.f90: Likewise. * gfortran.dg/include_6.f90: Update dg-*.
Diffstat (limited to 'gcc/fortran/module.cc')
-rw-r--r--gcc/fortran/module.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/fortran/module.cc b/gcc/fortran/module.cc
index 281b1b1..85aa153 100644
--- a/gcc/fortran/module.cc
+++ b/gcc/fortran/module.cc
@@ -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");