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

            Bug ID: 123339
           Summary: ICE: Segmentation fault in preprocessor with malformed
                    __has_include syntax <"foo"
           Product: gcc
           Version: 15.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: 522024330006 at smail dot nju.edu.cn
  Target Milestone: ---

Compiler Explorer: https://godbolt.org/z/nejaohMWG

The GCC preprocessor crashes (Segmentation fault) when encountering a malformed
__has_include directive with mixed and unclosed delimiters.

Program:
```c
__has_include <"foo"
```

Part of the traceback:
```console
internal compiler error: Segmentation fault
    2 | __has_include <"foo"
      | ^~~~~~~~~~~~~
0x290fae8 diagnostics::context::diagnostic_impl(rich_location*,
diagnostics::metadata const*, diagnostics::option_id, char const*,
__va_list_tag (*) [1], diagnostics::kind)
        ???:0
0x29048ab internal_error(char const*, ...)
        ???:0
0x29e21e2 _cpp_lex_direct
        ???:0
0x29e4080 _cpp_lex_token
        ???:0
0xeaf18a c_lex_with_flags(tree_node**, unsigned long*, unsigned char*, int)
        ???:0
0xd52cfa c_parse_file()
        ???:0
0xec4909 c_common_parse_file()
        ???:0
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
Compiler returned: 1
```
  • [Bug c++/123339] New: IC... 522024330006 at smail dot nju.edu.cn via Gcc-bugs

Reply via email to