https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122353
Bug ID: 122353
Summary: Segmentation fault with inline-asm
Product: gcc
Version: 15.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: qingren2hxb at gmail dot com
Target Milestone: ---
Created attachment 62590
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=62590&action=edit
bug report by using -freport-bug
========================================
$g++ -v
Using built-in specs.
COLLECT_GCC=/workspace/installation/bin/g++
COLLECT_LTO_WRAPPER=/workspace/installation/libexec/gcc/x86_64-pc-linux-gnu/15.1.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /workspace/gcc/configure --prefix=/workspace/installation
--enable-coverage --enable-checking --disable-multilib --disable-shared
--disable-bootstrap --enable-languages=c,c++
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 15.1.0 (GCC)
========================================
// test.C
#include <iostream>
template <class... Ts>
void inline_func(Ts... args) {
asm volatile("nop" : : "d"(args)...);
}
int main() {
int x = 42;
float y = 3.14f;
inline_func(x, y);
return 0;
}
========================================
$ g++ -std=c++20 test.C
test.C: In function 'void inline_func(Ts ...)':
test.C:3:37: error: expected ')' before '...' token [-Wtemplate-body]
3 | asm volatile("nop" : : "d"(args)...);
| ^~~
| )
test.C: In instantiation of 'void inline_func(Ts ...) [with Ts = {int,
float}]':
test.C:10:16: required from here
10 | inline_func(x, y);
| ~~~~~~~~~~~^~~~~~
test.C:3:5: internal compiler error: Segmentation fault
3 | asm volatile("nop" : : "d"(args)...);
| ^~~
0x5d4e2e6 internal_error(char const*, ...)
/workspace/gcc/gcc/diagnostic-global-context.cc:517
0x270d8a0 crash_signal
/workspace/gcc/gcc/toplev.cc:322
0x16d6501 decay_conversion(tree_node*, int, bool)
/workspace/gcc/gcc/cp/typeck.cc:2504
0x15fcfb3 finish_asm_stmt(unsigned long, int, tree_node*, tree_node*,
tree_node*, tree_node*, tree_node*, bool, bool)
/workspace/gcc/gcc/cp/semantics.cc:2403
0x154df4e tsubst_stmt
/workspace/gcc/gcc/cp/pt.cc:19315
0x154cfaf tsubst_stmt
/workspace/gcc/gcc/cp/pt.cc:19238
0x15939af instantiate_body
/workspace/gcc/gcc/cp/pt.cc:27737
0x15966df instantiate_decl(tree_node*, bool, bool)
/workspace/gcc/gcc/cp/pt.cc:28026
0x1596d0f instantiate_pending_templates(int)
/workspace/gcc/gcc/cp/pt.cc:28103
0x118c2cd c_parse_final_cleanups()
/workspace/gcc/gcc/cp/decl2.cc:5571
0x1847199 c_common_parse_file()
/workspace/gcc/gcc/c-family/c-opts.cc:1397
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.