https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120262
Bug ID: 120262
Summary: internal compiler error: in remap_type_1 since version
12.1
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: mario.rodriguezb1 at um dot es
Target Milestone: ---
The following code ICE in <source>:16:5: internal compiler error: in
remap_type_1, at tree-inline.cc:575
```
#include <iostream>
int main()
{
using namespace std::string_literals;
auto matrix = [] {
int n, m;
int matrix [m][n];
for (size_t i = 0; i < 2; ++i)
{
for (size_t j = 0; j < 2; ++j)
{
std::cin >> matrix[i][j];
}
}
return matrix;
}();
}
```
Stack dump
```
<source>: In static member function 'static constexpr int (*
main()::<lambda()>::_FUN())[n]':
<source>:16:5: internal compiler error: in remap_type_1, at tree-inline.cc:575
16 | }();
| ^
0x2941455 diagnostic_context::diagnostic_impl(rich_location*,
diagnostic_metadata const*, diagnostic_option_id, char const*, __va_list_tag
(*) [1], diagnostic_t)
???:0
0x295e656 internal_error(char const*, ...)
???:0
0xada8ac fancy_abort(char const*, int, char const*)
???:0
0x14fdc02 remap_type(tree_node*, copy_body_data*)
???:0
0x14fdc02 remap_type(tree_node*, copy_body_data*)
???:0
0x1500951 copy_tree_body_r(tree_node**, int*, void*)
???:0
0x180800c walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set<tree_node*, false, default_hash_traits<tree_node*> >*,
tree_node* (*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set<tree_node*, false, default_hash_traits<tree_node*> >*))
???:0
0x1808208 walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set<tree_node*, false, default_hash_traits<tree_node*> >*,
tree_node* (*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set<tree_node*, false, default_hash_traits<tree_node*> >*))
???:0
0x14fe92d copy_fn(tree_node*, tree_node*&, tree_node*&)
???:0
0xb56c85 maybe_save_constexpr_fundef(tree_node*)
???:0
0xbca98f finish_function(bool)
???:0
0xc160ca maybe_add_lambda_conv_op(tree_node*)
???:0
0xcfead3 c_parse_file()
???:0
0xe614f9 c_common_parse_file()
???:0
```
To reproduce:
https://godbolt.org/z/aEzTha1hs