public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/54033] New: gfortran: Passing file as include directory - add diagnostic and ICE with -cpp
@ 2012-07-19 14:30 burnus at gcc dot gnu.org
  2012-07-22 20:06 ` [Bug fortran/54033] " tkoenig at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-07-19 14:30 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54033

             Bug #: 54033
           Summary: gfortran: Passing file as include directory - add
                    diagnostic and ICE with -cpp
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Keywords: diagnostic, ice-on-invalid-code
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: burnus@gcc.gnu.org


Based on the report by Vladimír Fuka at
http://gcc.gnu.org/ml/fortran/2012-07/msg00089.html

Do:
  touch file
  gfortran -I file test.f90

Result:
  Nothing.

Expected: As with gcc:
  cc1: warning: foo: not a directory [enabled by default]

(That's in gcc/incpath.c's remove_duplicates - which is publical accessible via
register_include_chains -> merge_include_chains -> remove_duplicates)



If one uses the preprocessor (-cpp), one even gets an ICE:

Program received signal SIGABRT, Aborted.

#1  0x00002aaaabe0f1a8 in __GI_abort () at abort.c:91
#2  0x0000000000e56a27 in cpp_diagnostic_with_line (pfile=0x16a1450,
    level=<optimized out>, reason=<optimized out>, src_loc=<optimized out>,
    column=<optimized out>, msgid=<optimized out>, ap=0x7fffffffd948)
    at libcpp/errors.c:145
#3  0x0000000000e56d29 in cpp_error_with_line (pfile=<optimized out>,
    level=<optimized out>, src_loc=<optimized out>, column=<optimized out>,
    msgid=<optimized out>)  at libcpp/errors.c:164
#4  0x000000000085a07a in remove_duplicates (pfile=pfile@entry=0x16a1450,
    head=0x16a10e0, system=0x16bd1a0, join=0x16bd1a0, verbose=verbose@entry=1)
    at gcc/incpath.c:251
#5  0x000000000085a582 in merge_include_chains (verbose=1, pfile=0x16a1450,
    sysroot=0x0) at gcc/incpath.c:341
#6  register_include_chains (pfile=<optimized out>, sysroot=0x0, iprefix=0x0,
    imultilib=0x0, stdinc=1, cxx_stdinc=<optimized out>, verbose=1)
    at gcc/incpath.c:466
#7  0x0000000000562c88 in gfc_cpp_register_include_paths ()
    at gcc/fortran/cpp.c:694


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug fortran/54033] gfortran: Passing file as include directory - add diagnostic and ICE with -cpp
  2012-07-19 14:30 [Bug fortran/54033] New: gfortran: Passing file as include directory - add diagnostic and ICE with -cpp burnus at gcc dot gnu.org
@ 2012-07-22 20:06 ` tkoenig at gcc dot gnu.org
  2012-08-01 21:44 ` tkoenig at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2012-07-22 20:06 UTC (permalink / raw)
  To: gcc-bugs

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);


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug fortran/54033] gfortran: Passing file as include directory - add diagnostic and ICE with -cpp
  2012-07-19 14:30 [Bug fortran/54033] New: gfortran: Passing file as include directory - add diagnostic and ICE with -cpp burnus at gcc dot gnu.org
  2012-07-22 20:06 ` [Bug fortran/54033] " tkoenig at gcc dot gnu.org
@ 2012-08-01 21:44 ` tkoenig at gcc dot gnu.org
  2012-08-01 21:46 ` tkoenig at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2012-08-01 21:44 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54033

--- Comment #2 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2012-08-01 21:43:54 UTC ---
Author: tkoenig
Date: Wed Aug  1 21:43:50 2012
New Revision: 190054

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=190054
Log:
2012-08-01  Thomas König  <tkoenig@gcc.gnu.org>

    PR fortran/54033
    * scanner.c (add_path_to_list): Emit warning if an error occurs
    for an include path, if it is not present or if it is not a
    directory.  Do not add the path in these cases.

2012-08-01  Thomas König  <tkoenig@gcc.gnu.org>

    PR fortran/54033
    * gfortran.dg/include_6.f90:  New test case.
    * gfortran.dg/include_7.f90:  New test case.
    * gfortran.dg/include_3.f90:  Add dg-warning for missing directory.


Added:
    trunk/gcc/testsuite/gfortran.dg/include_6.f90
    trunk/gcc/testsuite/gfortran.dg/include_7.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/scanner.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gfortran.dg/include_3.f95


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug fortran/54033] gfortran: Passing file as include directory - add diagnostic and ICE with -cpp
  2012-07-19 14:30 [Bug fortran/54033] New: gfortran: Passing file as include directory - add diagnostic and ICE with -cpp burnus at gcc dot gnu.org
  2012-07-22 20:06 ` [Bug fortran/54033] " tkoenig at gcc dot gnu.org
  2012-08-01 21:44 ` tkoenig at gcc dot gnu.org
@ 2012-08-01 21:46 ` tkoenig at gcc dot gnu.org
  2012-08-04 18:27 ` hjl at gcc dot gnu.org
  2013-01-20 12:34 ` tkoenig at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2012-08-01 21:46 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54033

--- Comment #3 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2012-08-01 21:45:49 UTC ---
Fixed on trunk, closing.

Thanks for the bug report!


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug fortran/54033] gfortran: Passing file as include directory - add diagnostic and ICE with -cpp
  2012-07-19 14:30 [Bug fortran/54033] New: gfortran: Passing file as include directory - add diagnostic and ICE with -cpp burnus at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2012-08-01 21:46 ` tkoenig at gcc dot gnu.org
@ 2012-08-04 18:27 ` hjl at gcc dot gnu.org
  2013-01-20 12:34 ` tkoenig at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: hjl at gcc dot gnu.org @ 2012-08-04 18:27 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54033

--- Comment #4 from hjl at gcc dot gnu.org <hjl at gcc dot gnu.org> 2012-08-04 18:27:04 UTC ---
Author: hjl
Date: Sat Aug  4 18:26:56 2012
New Revision: 190144

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=190144
Log:
Fix PR 54033, problems with -I, with test cases

     PR fortran/54033
     * scanner.c (add_path_to_list):  New argument warn.  Don't
     warn if it is true.
     (gfc_add_include_path):  Warn if directory is missing.
     (gfc_add_intrinsic_modules_path):  Do not warn if directory
     is missing.
     * optinons.c (gfc_handle_option):  Do not add directory
     for intrinsic modules to normal include path.

Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/options.c
    trunk/gcc/fortran/scanner.c


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug fortran/54033] gfortran: Passing file as include directory - add diagnostic and ICE with -cpp
  2012-07-19 14:30 [Bug fortran/54033] New: gfortran: Passing file as include directory - add diagnostic and ICE with -cpp burnus at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2012-08-04 18:27 ` hjl at gcc dot gnu.org
@ 2013-01-20 12:34 ` tkoenig at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2013-01-20 12:34 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54033

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #5 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2013-01-20 12:33:50 UTC ---
Really closing.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-01-20 12:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-19 14:30 [Bug fortran/54033] New: gfortran: Passing file as include directory - add diagnostic and ICE with -cpp burnus at gcc dot gnu.org
2012-07-22 20:06 ` [Bug fortran/54033] " tkoenig at gcc dot gnu.org
2012-08-01 21:44 ` tkoenig at gcc dot gnu.org
2012-08-01 21:46 ` tkoenig at gcc dot gnu.org
2012-08-04 18:27 ` hjl at gcc dot gnu.org
2013-01-20 12:34 ` tkoenig at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).