https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120558
Bug ID: 120558
Summary: ICE: Segmentation fault at (munge and make_write_name)
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: iamanonymous.cs at gmail dot com
Target Milestone: ---
Target: x86_64
*******************************************************************************
The compiler produces an internal error during munge and make_write_name when
compiling the provided code with the specified options.
The issue can also be reproduced on Compiler Explorer.
*******************************************************************************
OS and Platform:
# uname -a
Linux ubuntu 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023
x86_64 x86_64 x86_64 GNU/Linux
*******************************************************************************
# g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/root/gdbtest/gcc/gcc-250601/libexec/gcc/x86_64-pc-linux-gnu/16.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --prefix=/root/gdbtest/gcc/gcc-250601
--enable-languages=c,c++ --disable-multilib --disable-bootstrap
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 16.0.0 20250601 (experimental) (GCC)
*******************************************************************************
Program:
#cat code.cpp
auto test() {
return __array_extent(int, );
}
*******************************************************************************
Command Lines:
g++ code.cpp -pipe -MMD -MP -MQ ./ -MT test.o -MF test.d -c -o code_0.o
<source>: In function 'auto test()':
<source>:3:25: error: expected primary-expression before 'int'
3 | return __array_extent(int, );
| ^~~
<source>:3:30: error: expected primary-expression before ')' token
3 | return __array_extent(int, );
| ^
<source>:3:10: error: '__array_extent' was not declared in this scope
3 | return __array_extent(int, );
| ^~~~~~~~~~~~~~
<source>: At global scope:
<source>:4:1: internal compiler error: Segmentation fault
4 | }
| ^
0x282e045 diagnostic_context::diagnostic_impl(rich_location*,
diagnostic_metadata const*, diagnostic_option_id, char const*, __va_list_tag
(*) [1], diagnostic_t)
???:0
0x284f786 internal_error(char const*, ...)
???:0
0x28f9f29 deps_write(cpp_reader const*, _IO_FILE*, unsigned int)
???:0
0x28e5657 cpp_finish(cpp_reader*, _IO_FILE*, _IO_FILE*)
???:0
0xe6c020 c_common_finish()
???: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
*******************************************************************************
Also ICE on trunk, compiler explorer:https://godbolt.org/z/nrfh1Wrz8
*******************************************************************************