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

* [Bug c++/113598] GCC internal compiler error
  2024-01-25 12:34 [Bug c++/113598] New: GCC internal compiler error jlame646 at gmail dot com
@ 2024-01-25 15:44 ` 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
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2024-01-25 15:44 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|ice-on-invalid-code         |ice-on-valid-code
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2024-01-25
     Ever confirmed|0                           |1
                 CC|                            |mpolacek at gcc dot gnu.org

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
All the other compilers accept this.

Even 4.9 ICEs for me though, so it looks like an old problem.

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

* [Bug c++/113598] [11/12/13/14 Regression] GCC internal compiler error
  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 ` 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
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-01-25 16:07 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|GCC internal compiler error |[11/12/13/14 Regression]
                   |                            |GCC internal compiler error
      Known to work|                            |4.4.7, 4.8.1, 4.8.5
      Known to fail|                            |4.9.0, 5.1.0
   Target Milestone|---                         |11.5

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Reduced testcase:
```
struct Cpu
{
    int op_nop();
};
typedef int(Cpu::*OpCode)();
void f()
{
  new OpCode[256]{&Cpu::op_nop};
}
```

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

* [Bug c++/113598] [11/12/13/14 Regression] GCC internal compiler error since r0-124275
  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 ` jakub at gcc dot gnu.org
  2024-01-25 16:23 ` jakub at gcc dot gnu.org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-01-25 16:22 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[11/12/13/14 Regression]    |[11/12/13/14 Regression]
                   |GCC internal compiler error |GCC internal compiler error
                   |                            |since r0-124275
                 CC|                            |jakub at gcc dot gnu.org,
                   |                            |jason at gcc dot gnu.org

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Started with r0-124275-g16b53405ad2baba783cf7ecf34a623fd64db2dda aka PR57402
fix.

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

* [Bug c++/113598] [11/12/13/14 Regression] GCC internal compiler error since r0-124275
  2024-01-25 12:34 [Bug c++/113598] New: GCC internal compiler error jlame646 at gmail dot com
                   ` (2 preceding siblings ...)
  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
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2024-01-25 16:23 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2

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

* [Bug c++/113598] [11/12/13/14 Regression] GCC internal compiler error since r0-124275
  2024-01-25 12:34 [Bug c++/113598] New: GCC internal compiler error jlame646 at gmail dot com
                   ` (3 preceding siblings ...)
  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
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jason at gcc dot gnu.org @ 2024-01-25 17:02 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |jason at gcc dot gnu.org

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

* [Bug c++/113598] [11/12/13/14 Regression] GCC internal compiler error since r0-124275
  2024-01-25 12:34 [Bug c++/113598] New: GCC internal compiler error jlame646 at gmail dot com
                   ` (4 preceding siblings ...)
  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
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-01-25 20:22 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Jason Merrill <jason@gcc.gnu.org>:

https://gcc.gnu.org/g:136a828754ff65079a834555582b49d54bd5bc64

commit r14-8438-g136a828754ff65079a834555582b49d54bd5bc64
Author: Jason Merrill <jason@redhat.com>
Date:   Thu Jan 25 12:02:07 2024 -0500

    c++: array of PMF [PR113598]

    Here AGGREGATE_TYPE_P includes pointers to member functions, which is not
    what we want.  Instead we should use class||array, as elsewhere in the
    function.

            PR c++/113598

    gcc/cp/ChangeLog:

            * init.cc (build_vec_init): Don't use {} for PMF.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp0x/initlist-pmf2.C: New test.

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

* [Bug c++/113598] [11/12/13 Regression] GCC internal compiler error since r0-124275
  2024-01-25 12:34 [Bug c++/113598] New: GCC internal compiler error jlame646 at gmail dot com
                   ` (5 preceding siblings ...)
  2024-01-25 20:22 ` cvs-commit at gcc dot gnu.org
@ 2024-05-24 13:25 ` cvs-commit at gcc dot gnu.org
  2024-05-24 13:26 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-05-24 13:25 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by Jason Merrill
<jason@gcc.gnu.org>:

https://gcc.gnu.org/g:5f1457841abc2fd8657a52d1371c983ac010f1cc

commit r13-8798-g5f1457841abc2fd8657a52d1371c983ac010f1cc
Author: Jason Merrill <jason@redhat.com>
Date:   Thu Jan 25 12:02:07 2024 -0500

    c++: array of PMF [PR113598]

    Here AGGREGATE_TYPE_P includes pointers to member functions, which is not
    what we want.  Instead we should use class||array, as elsewhere in the
    function.

            PR c++/113598

    gcc/cp/ChangeLog:

            * init.cc (build_vec_init): Don't use {} for PMF.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp0x/initlist-pmf2.C: New test.

    (cherry picked from commit 136a828754ff65079a834555582b49d54bd5bc64)

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

* [Bug c++/113598] [11/12/13 Regression] GCC internal compiler error since r0-124275
  2024-01-25 12:34 [Bug c++/113598] New: GCC internal compiler error jlame646 at gmail dot com
                   ` (6 preceding siblings ...)
  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
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-05-24 13:26 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Jason Merrill
<jason@gcc.gnu.org>:

https://gcc.gnu.org/g:419b5e17eace9b6b985b9853db0dc1a5478375b6

commit r12-10467-g419b5e17eace9b6b985b9853db0dc1a5478375b6
Author: Jason Merrill <jason@redhat.com>
Date:   Thu Jan 25 12:02:07 2024 -0500

    c++: array of PMF [PR113598]

    Here AGGREGATE_TYPE_P includes pointers to member functions, which is not
    what we want.  Instead we should use class||array, as elsewhere in the
    function.

            PR c++/113598

    gcc/cp/ChangeLog:

            * init.cc (build_vec_init): Don't use {} for PMF.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp0x/initlist-pmf2.C: New test.

    (cherry picked from commit 136a828754ff65079a834555582b49d54bd5bc64)

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

* [Bug c++/113598] [11/12/13 Regression] GCC internal compiler error since r0-124275
  2024-01-25 12:34 [Bug c++/113598] New: GCC internal compiler error jlame646 at gmail dot com
                   ` (7 preceding siblings ...)
  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
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-05-24 18:38 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Jason Merrill
<jason@gcc.gnu.org>:

https://gcc.gnu.org/g:38de942670ad39c60ba4feae893d11843e0aebe8

commit r11-11449-g38de942670ad39c60ba4feae893d11843e0aebe8
Author: Jason Merrill <jason@redhat.com>
Date:   Thu Jan 25 12:02:07 2024 -0500

    c++: array of PMF [PR113598]

    Here AGGREGATE_TYPE_P includes pointers to member functions, which is not
    what we want.  Instead we should use class||array, as elsewhere in the
    function.

            PR c++/113598

    gcc/cp/ChangeLog:

            * init.c (build_vec_init): Don't use {} for PMF.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp0x/initlist-pmf2.C: New test.

    (cherry picked from commit 136a828754ff65079a834555582b49d54bd5bc64)

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

* [Bug c++/113598] [11/12/13 Regression] GCC internal compiler error since r0-124275
  2024-01-25 12:34 [Bug c++/113598] New: GCC internal compiler error jlame646 at gmail dot com
                   ` (8 preceding siblings ...)
  2024-05-24 18:38 ` cvs-commit at gcc dot gnu.org
@ 2024-05-24 18:40 ` jason at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: jason at gcc dot gnu.org @ 2024-05-24 18:40 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #8 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed for 11.5/12.4/13.4/14.

^ 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).