https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104471
Bug ID: 104471 Summary: ICE with -nostdinc: NULL directory in find_file Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: gs...@t-online.de Target Milestone: --- Affects versions down to at least r5 : (related to pr80753 and pr80755) $ cat z1.c #if __has_include (<stdlib.h>) #endif $ gcc-12-20220206 -c z1.c -nostdinc z1.c:1:20: error: no include path in which to search for stdlib.h 1 | #if __has_include (<stdlib.h>) | ^~~~~~~~~~ cc1: internal compiler error: NULL directory in find_file 0x7c8de2 c_cpp_diagnostic(cpp_reader*, cpp_diagnostic_level, cpp_warning_reason, rich_location*, char const*, __va_list_tag (*) [1]) ../../gcc/c-family/c-common.cc:6670 0x1e12599 cpp_error_at(cpp_reader*, cpp_diagnostic_level, unsigned int, char const*, ...) ../../libcpp/errors.cc:302 0x1e17833 _cpp_find_file ../../libcpp/files.cc:516 0x1e18eba _cpp_has_header ../../libcpp/files.cc:2149 0x1e284f7 builtin_has_include ../../libcpp/macro.cc:429 0x1e284f7 _cpp_builtin_macro_text ../../libcpp/macro.cc:677 0x1e28769 builtin_macro ../../libcpp/macro.cc:762 0x1e25e73 enter_macro_context ../../libcpp/macro.cc:1588 0x1e27b60 cpp_get_token_1 ../../libcpp/macro.cc:3018 0x1e149a4 _cpp_parse_expr ../../libcpp/expr.cc:1334 0x1e0eb43 do_if ../../libcpp/directives.cc:2060 0x1e10450 _cpp_handle_directive ../../libcpp/directives.cc:557 0x1e20c88 _cpp_lex_token ../../libcpp/lex.cc:3410 0x1e279ff cpp_get_token_1 ../../libcpp/macro.cc:2930 0x7e553d c_lex_with_flags(tree_node**, unsigned int*, unsigned char*, int) ../../gcc/c-family/c-lex.cc:483 0x74bb81 c_lex_one_token ../../gcc/c/c-parser.cc:279 0x788454 c_parser_peek_token(c_parser*) ../../gcc/c/c-parser.cc:483 0x788454 c_parse_file() ../../gcc/c/c-parser.cc:23317 0x7f7812 c_common_parse_file() ../../gcc/c-family/c-opts.cc:1238