https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113598
Bug ID: 113598 Summary: GCC internal compiler error Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: jlame646 at gmail dot com Target Milestone: --- GCC rejects the following valid program. https://godbolt.org/z/zr1MbP1r7 ``` #include <functional> #include <cstdint> using namespace std; class Cpu { private: typedef uint8_t(Cpu::*OpCode)(); OpCode *op_codes; // how to define array of 256 function pointers? uint8_t op_nop(); uint8_t op_lxi(); uint8_t op_stax(); uint8_t op_mov(); uint8_t op_mvi(); Cpu(); void SingleStep(); }; Cpu::Cpu(): op_codes(new OpCode[256]{&Cpu::op_nop, &Cpu::op_lxi, &Cpu::op_stax}) { } void Cpu::SingleStep() { uint8_t op_code = 0x00; //call using std::invoke std::invoke(op_codes[op_code], this); //old style call without std::invoke (this->*op_codes[op_code])(); } ``` GCC says: ``` <source>: In constructor 'Cpu::Cpu()': <source>:18:79: internal compiler error: in gimplify_init_constructor, at gimplify.cc:5780 18 | Cpu::Cpu(): op_codes(new OpCode[256]{&Cpu::op_nop, &Cpu::op_lxi, &Cpu::op_stax}) | ^ 0x2646adc internal_error(char const*, ...) ???:0 0xa51985 fancy_abort(char const*, int, char const*) ???:0 0x1047dbc gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) ???:0 0x1048280 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) ???:0 0x1047f97 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) ???:0 0x104b2ea gimplify_stmt(tree_node**, gimple**) ???:0 0x10491f3 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) ???:0 0x1047dbc gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) ???:0 0x1047f97 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) ???:0 0x104b2ea gimplify_stmt(tree_node**, gimple**) ???:0 0x10480ee gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) ???:0 0x104b2ea gimplify_stmt(tree_node**, gimple**) ???:0 0x10491f3 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) ???:0 0x105e5a3 gimplify_body(tree_node*, bool) ???:0 0x105e9df gimplify_function_tree(tree_node*) ???:0 0xe74077 cgraph_node::analyze() ???:0 0xe773c1 symbol_table::finalize_compilation_unit() ???:0 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. Compiler returned: 1 ```