[Bug fortran/54033] gfortran: Passing file as include directory - add diagnostic and ICE with -cpp
tkoenig at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sun Jul 22 20:06:00 GMT 2012
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);
More information about the Gcc-bugs
mailing list