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

            Bug ID: 123398
           Summary: ICE: Segmentation fault in tsubst_expr
           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: ---

Reproducer: https://godbolt.org/z/nznq97TY4

GCC crashes with a Segmentation fault when instantiating a generic lambda that
uses a variadic parameter inside a trailing decltype return type.

```c
int main() {
    extern void target_func(int);
    auto func = [](auto... args) -> decltype(target_func(args...)) {};
    func(5);
}
```

Traceback:
```
nternal compiler error: Segmentation fault
    4 |     auto func = [](auto... args) -> decltype(target_func(args...)) {};
      |                                              ~~~~~~~~~~~^~~~~~~~~
0x5da1dc8 internal_error(char const*, ...)
        /workspace/install/gcc/src/gcc/gcc/diagnostic-global-context.cc:517
0x273a9a4 crash_signal
        /workspace/install/gcc/src/gcc/gcc/toplev.cc:322
0x7ffff79d932f ???
        ./signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c:0
0x152e829 tsubst_expr(tree_node*, tree_node*, int, tree_node*)
        /workspace/install/gcc/src/gcc/gcc/cp/pt.cc:21984
0x1528512 tsubst_expr(tree_node*, tree_node*, int, tree_node*)
        /workspace/install/gcc/src/gcc/gcc/cp/pt.cc:21358
0x1500309 tsubst(tree_node*, tree_node*, int, tree_node*)
        /workspace/install/gcc/src/gcc/gcc/cp/pt.cc:17250
0x14f8004 tsubst_function_type
        /workspace/install/gcc/src/gcc/gcc/cp/pt.cc:16164
0x14fe5d2 tsubst(tree_node*, tree_node*, int, tree_node*)
        /workspace/install/gcc/src/gcc/gcc/cp/pt.cc:17030
0x14e5cff tsubst_function_decl
        /workspace/install/gcc/src/gcc/gcc/cp/pt.cc:14839
0x14f1dae tsubst_decl
        /workspace/install/gcc/src/gcc/gcc/cp/pt.cc:15410
0x15366aa instantiate_template(tree_node*, tree_node*, int)
        /workspace/install/gcc/src/gcc/gcc/cp/pt.cc:22778
0x153a22d fn_type_unification(tree_node*, tree_node*, tree_node*, tree_node*
const*, unsigned int, tree_node*, unification_kind_t, int, conversion**, bool,
bool)
        /workspace/install/gcc/src/gcc/gcc/cp/pt.cc:23318
0xe8a57d add_template_candidate_real
        /workspace/install/gcc/src/gcc/gcc/cp/call.cc:3723
0xe8af06 add_template_candidate
        /workspace/install/gcc/src/gcc/gcc/cp/call.cc:3813
0xe9fc78 add_candidates
        /workspace/install/gcc/src/gcc/gcc/cp/call.cc:6872
0xe95172 build_op_call(tree_node*, vec<tree_node*, va_gc, vl_embed>**, int)
        /workspace/install/gcc/src/gcc/gcc/cp/call.cc:5469
0x15ccdbb finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**,
bool, bool, int)
        /workspace/install/gcc/src/gcc/gcc/cp/semantics.cc:3525
0x137449f cp_parser_postfix_expression
        /workspace/install/gcc/src/gcc/gcc/cp/parser.cc:8474
0x137a2ce cp_parser_unary_expression
        /workspace/install/gcc/src/gcc/gcc/cp/parser.cc:9735
0x137cf99 cp_parser_cast_expression
        /workspace/install/gcc/src/gcc/gcc/cp/parser.cc:10650
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.
```
  • [Bug c++/123398] New: IC... 522024330006 at smail dot nju.edu.cn via Gcc-bugs

Reply via email to