https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117521
Bug ID: 117521
Summary: ICE with duplicate placeholder variables
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: drepper.fsp+rhbz at gmail dot com
Target Milestone: ---
The following code causes an ICE with gcc 14.2 as well as the trunk version
from 2024-11-4:
#include <tuple>
#include <vector>
#ifndef P
#define P _
#endif
void f(const std::vector<std::tuple<int,int,int>>& v)
{
for (auto& [_,P,c] : v)
asm("" : : "m"(v));
}
when compiled with
g++ -c -std=gnu++2c e.cc
e.cc: In function ‘void f(const std::vector<std::tuple<int, int, int> >&)’:
e.cc:10:22: internal compiler error: Segmentation fault
10 | for (auto& [_,P,c] : v)
| ^
0x7fbffec10dcf ???
/usr/src/debug/glibc-2.40-9.fc41.x86_64/signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c:0
0x7fbffebfa247 __libc_start_call_main
../sysdeps/nptl/libc_start_call_main.h:58
0x7fbffebfa30a __libc_start_main_impl
../csu/libc-start.c:360
when instead compiled with
g++ -c -std=gnu++2c e.cc -DP=b
there is no problem.