[Bug fortran/79287] New: include files not searched for relative to the file containing the fortran include statement

okiddle at yahoo dot co.uk gcc-bugzilla@gcc.gnu.org
Mon Jan 30 16:43:00 GMT 2017


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79287

            Bug ID: 79287
           Summary: include files not searched for relative to the file
                    containing the fortran include statement
           Product: gcc
           Version: 6.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: okiddle at yahoo dot co.uk
  Target Milestone: ---

I have some Fortran code that makes use of the Fortran INCLUDE statement (as
opposed to the preprocessor). A source file includes an include file which in
turn includes another source file. Specifying no search path with -I it is able
to find the first include file, looking relative to the original source file
but when looking for the second include file it is not looking relative to the
first include file (the file containing the INCLUDE statement). The same code
compiles with the Intel or Solaris compilers.

As a basic test:
  hello.f90 contains INCLUDE 'include/first.inc'
  include/first.inc contains INCLUDE 'second.inc'
  include/second.inc contains whatever

In order to find second.inc, it should look relative to the directory
containing first.inc.


More information about the Gcc-bugs mailing list