public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/113598] New: GCC internal compiler error
@ 2024-01-25 12:34 jlame646 at gmail dot com
  2024-01-25 15:44 ` [Bug c++/113598] " mpolacek at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: jlame646 at gmail dot com @ 2024-01-25 12:34 UTC (permalink / raw)
  To: gcc-bugs

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
```

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2024-05-24 18:40 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-25 12:34 [Bug c++/113598] New: GCC internal compiler error jlame646 at gmail dot com
2024-01-25 15:44 ` [Bug c++/113598] " mpolacek at gcc dot gnu.org
2024-01-25 16:07 ` [Bug c++/113598] [11/12/13/14 Regression] " pinskia at gcc dot gnu.org
2024-01-25 16:22 ` [Bug c++/113598] [11/12/13/14 Regression] GCC internal compiler error since r0-124275 jakub at gcc dot gnu.org
2024-01-25 16:23 ` jakub at gcc dot gnu.org
2024-01-25 17:02 ` jason at gcc dot gnu.org
2024-01-25 20:22 ` cvs-commit at gcc dot gnu.org
2024-05-24 13:25 ` [Bug c++/113598] [11/12/13 " cvs-commit at gcc dot gnu.org
2024-05-24 13:26 ` cvs-commit at gcc dot gnu.org
2024-05-24 18:38 ` cvs-commit at gcc dot gnu.org
2024-05-24 18:40 ` jason at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).