Hello world, the attached patch fixes a regression where -J dirpath/ would issue a warning on Windows because of the trailing dir separator.
Regression-tested, but only on Linux. I would appreciate if somebody could also test it on Windows (and run the test case, of course). OK for trunk? Thomas 2013-01-20 Thomas Koenig <tkoe...@gcc.gnu.org> PR fortran/55919 * add_path_to_list: Copy path to temporary and strip trailing directory separators before calling stat(). 2013-01-20 Thomas Koenig <tkoe...@gcc.gnu.org> PR fortran/55919 * gfortran.dg/include_8.f90: New test.
Index: scanner.c =================================================================== --- scanner.c (Revision 195319) +++ scanner.c (Arbeitskopie) @@ -310,14 +310,26 @@ add_path_to_list (gfc_directorylist **list, const { gfc_directorylist *dir; const char *p; + char *q; struct stat st; + size_t len; + int i; p = path; while (*p == ' ' || *p == '\t') /* someone might do "-I include" */ if (*p++ == '\0') return; - if (stat (p, &st)) + /* Strip trailing directory separators from the path, as this + will confuse Windows systems. */ + len = strlen (p); + q = (char *) alloca (len + 1); + memcpy (q, p, len + 1); + i = len - 1; + while (i >=0 && IS_DIR_SEPARATOR(q[i])) + q[i--] = '\0'; + + if (stat (q, &st)) { if (errno != ENOENT) gfc_warning_now ("Include directory \"%s\": %s", path,