This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/54033] gfortran: Passing file as include directory - add diagnostic and ICE with -cpp
- From: "tkoenig at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 22 Jul 2012 20:06:18 +0000
- Subject: [Bug fortran/54033] gfortran: Passing file as include directory - add diagnostic and ICE with -cpp
- Auto-submitted: auto-generated
- References: <bug-54033-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54033
Thomas Koenig <tkoenig at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2012-07-22
CC| |tkoenig at gcc dot gnu.org
Ever Confirmed|0 |1
--- Comment #1 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2012-07-22 20:06:18 UTC ---
This patch looks OK so far.
Index: scanner.c
===================================================================
--- scanner.c (Revision 189754)
+++ scanner.c (Arbeitskopie)
@@ -311,12 +311,31 @@ add_path_to_list (gfc_directorylist **list, const
{
gfc_directorylist *dir;
const char *p;
-
+ struct stat st;
+
p = path;
while (*p == ' ' || *p == '\t') /* someone might do "-I include" */
if (*p++ == '\0')
return;
+ if (stat (p, &st))
+ {
+ if (errno != ENOENT)
+ gfc_warning_now ("Include directory \"%s\": %s", path,
+ xstrerror(errno));
+ else
+ /* FIXME: Also support -Wmissing-include-dirs. */
+ gfc_warning_now ("Include directory \"%s\" does not exist",
+ path);
+ return;
+ }
+
+ else if (!S_ISDIR (st.st_mode))
+ {
+ gfc_warning_now ("\"%s\" is not a directory", path);
+ return;
+ }
+
if (head || *list == NULL)
{
dir = XCNEW (gfc_directorylist);