https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115586
Bug ID: 115586
Summary: name-independent declarations causing an internal
compiler error (c++26)
Product: gcc
Version: 14.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: amuly.jain at gmail dot com
Target Milestone: ---
gcc -v output:
Using built-in specs.
COLLECT_GCC=g++-14
COLLECT_LTO_WRAPPER=/home/amuhak/gcc/gcc-14/bin/../libexec/gcc/x86_64-linux-gnu/14.1.0/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../gcc/configure -v --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
--prefix=/home/amuhak/build/gcc-14 --enable-checking=release
--enable-languages=c,c++,fortran,go --disable-multilib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 14.1.0 (GCC)
Command run: g++-14 main.cpp
Output:
main.cpp: In function ‘int main()’:
main.cpp:8:19: warning: name-independent declarations only available with
‘-std=c++2c’ or ‘-std=gnu++2c’ [-Wc++26-extensions]
8 | for (auto [_, _, a] : in) {
| ^
main.cpp:8:25: internal compiler error: Segmentation fault
8 | for (auto [_, _, a] : in) {
| ^
0x7f179196831f ???
./signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c:0
0x7f179194d1c9 __libc_start_call_main
../sysdeps/nptl/libc_start_call_main.h:58
0x7f179194d28a __libc_start_main_impl
../csu/libc-start.c:360
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.
Command run: g++-14 -freport-bug main.cpp
Output:
main.cpp: In function ‘int main()’:
main.cpp:8:19: warning: name-independent declarations only available with
‘-std=c++2c’ or ‘-std=gnu++2c’ [-Wc++26-extensions]
8 | for (auto [_, _, a] : in) {
| ^
main.cpp:8:25: internal compiler error: Segmentation fault
8 | for (auto [_, _, a] : in) {
| ^
0x7f5ccf93631f ???
./signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c:0
0x7f5ccf91b1c9 __libc_start_call_main
../sysdeps/nptl/libc_start_call_main.h:58
0x7f5ccf91b28a __libc_start_main_impl
../csu/libc-start.c:360
Please submit a full bug report, with preprocessed source.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
The bug is not reproducible, so it is likely a hardware or OS problem.
Here is a "working" example (https://godbolt.org/z/7vdoj7z3j):
#include <vector>
#include <tuple>
#include <iostream>
int main() {
std::vector<std::tuple<int, int, int>> in;
in.emplace_back(1, 2, 3);
for (auto [_, _, a] : in) {
std::cout << a << std::endl;
}
}