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

            Bug ID: 80755
           Summary: __has_include_next: internal compiler error: NULL
                    directory in find_file
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: preprocessor
          Assignee: unassigned at gcc dot gnu.org
          Reporter: p...@gcc-bugzilla.mail.kapsi.fi
  Target Milestone: ---

Created attachment 41358
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41358&action=edit
pulls last-include-dir/has_include_next

Hi.

__has_include_next gets confused, if it's called within a file that was
included in the very last include directory. Every GCC release since at least
4.9 is affected.

Note, the -idirafter is not culprit here. It's simply used to push the
`last-include-dir' as the last include directory in order to easily reproduce
this error. This problem does not occur, should there be any directory after
that in the search paths.

$ cat has_include_next.c
#include <has_include_next>

$ cat last-include-dir/has_include_next
#if __has_include_next(<anyfile>) // doesn't matter if exists
#endif

$ gcc -E -idirafter last-include-dir has_include_next.c
In file included from has_include_next.c:1:0:
last-include-dir/has_include_next:1:33: error: no include path in which to
search for anyfile
 #if __has_include_next(<anyfile>) // doesn't matter if exists
                                 ^
cc1.exe: internal compiler error: NULL directory in find_file

Reply via email to