public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/101040] New: [11 Regression] Internal compiler error: in get_or_insert_ctor_field, at cp/constexpr.c:3571
@ 2021-06-12 11:36 git at foonathan dot net
  2021-06-14  6:48 ` [Bug c++/101040] " rguenth at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: git at foonathan dot net @ 2021-06-12 11:36 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 101040
           Summary: [11 Regression] Internal compiler error: in
                    get_or_insert_ctor_field, at cp/constexpr.c:3571
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: git at foonathan dot net
  Target Milestone: ---

Minimal repro: https://godbolt.org/z/n71dhjPox

```
// This class has to be empty.
struct empty
{};

// This class has to be empty.
struct single
{
    // This member has to be no_unique_address.
    [[no_unique_address]] empty obj;
};

// This class has to be empty and derived from single.
struct derived : single
{
    // This constructor has to be constexpr and take a forwarding reference.
    template <typename Arg>
    constexpr derived(Arg&& arg) : single{arg}
    {}
};

auto obj = derived{empty{}};
```

Fails on GCC 11.1 and trunk:

```
source>:21:27:   in 'constexpr' expansion of 'derived(empty())'
<source>:21:27: internal compiler error: in get_or_insert_ctor_field, at
cp/constexpr.c:3571
   21 | auto obj = derived{empty{}};
      |                           ^
0x1d322a9 internal_error(char const*, ...)
        ???:0
0x71fc09 fancy_abort(char const*, int, char const*)
        ???:0
0xa58de0 store_init_value(tree_node*, tree_node*, vec<tree_node*, va_gc,
vl_embed>**, int)
        ???:0
0x818a14 cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int)
        ???:0
0x94812d c_parse_file()
        ???:0
0xacb002 c_common_parse_file()
        ???:0
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
Compiler returned: 1
```

Works with GCC 10.3.

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

* [Bug c++/101040] [11 Regression] Internal compiler error: in get_or_insert_ctor_field, at cp/constexpr.c:3571
  2021-06-12 11:36 [Bug c++/101040] New: [11 Regression] Internal compiler error: in get_or_insert_ctor_field, at cp/constexpr.c:3571 git at foonathan dot net
@ 2021-06-14  6:48 ` rguenth at gcc dot gnu.org
  2021-06-14  8:40 ` [Bug c++/101040] [11/12 Regression] Internal compiler error: in get_or_insert_ctor_field, at cp/constexpr.c:3571 since r11-7980-gc3d3bb0f03dbd025 marxin at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-06-14  6:48 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code
   Target Milestone|---                         |11.2
      Known to work|                            |10.3.0

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

* [Bug c++/101040] [11/12 Regression] Internal compiler error: in get_or_insert_ctor_field, at cp/constexpr.c:3571 since r11-7980-gc3d3bb0f03dbd025
  2021-06-12 11:36 [Bug c++/101040] New: [11 Regression] Internal compiler error: in get_or_insert_ctor_field, at cp/constexpr.c:3571 git at foonathan dot net
  2021-06-14  6:48 ` [Bug c++/101040] " rguenth at gcc dot gnu.org
@ 2021-06-14  8:40 ` marxin at gcc dot gnu.org
  2021-06-21 18:04 ` jason at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-06-14  8:40 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
                 CC|                            |jason at gcc dot gnu.org,
                   |                            |marxin at gcc dot gnu.org
   Last reconfirmed|                            |2021-06-14
            Summary|[11 Regression] Internal    |[11/12 Regression] Internal
                   |compiler error: in          |compiler error: in
                   |get_or_insert_ctor_field,   |get_or_insert_ctor_field,
                   |at cp/constexpr.c:3571      |at cp/constexpr.c:3571
                   |                            |since
                   |                            |r11-7980-gc3d3bb0f03dbd025
     Ever confirmed|0                           |1

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Confirmed, started with r11-7980-gc3d3bb0f03dbd025.

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

* [Bug c++/101040] [11/12 Regression] Internal compiler error: in get_or_insert_ctor_field, at cp/constexpr.c:3571 since r11-7980-gc3d3bb0f03dbd025
  2021-06-12 11:36 [Bug c++/101040] New: [11 Regression] Internal compiler error: in get_or_insert_ctor_field, at cp/constexpr.c:3571 git at foonathan dot net
  2021-06-14  6:48 ` [Bug c++/101040] " rguenth at gcc dot gnu.org
  2021-06-14  8:40 ` [Bug c++/101040] [11/12 Regression] Internal compiler error: in get_or_insert_ctor_field, at cp/constexpr.c:3571 since r11-7980-gc3d3bb0f03dbd025 marxin at gcc dot gnu.org
@ 2021-06-21 18:04 ` jason at gcc dot gnu.org
  2021-06-26  4:13 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jason at gcc dot gnu.org @ 2021-06-21 18:04 UTC (permalink / raw)
  To: gcc-bugs

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

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] 8+ messages in thread

* [Bug c++/101040] [11/12 Regression] Internal compiler error: in get_or_insert_ctor_field, at cp/constexpr.c:3571 since r11-7980-gc3d3bb0f03dbd025
  2021-06-12 11:36 [Bug c++/101040] New: [11 Regression] Internal compiler error: in get_or_insert_ctor_field, at cp/constexpr.c:3571 git at foonathan dot net
                   ` (2 preceding siblings ...)
  2021-06-21 18:04 ` jason at gcc dot gnu.org
@ 2021-06-26  4:13 ` cvs-commit at gcc dot gnu.org
  2021-06-26  4:16 ` jason at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-06-26  4:13 UTC (permalink / raw)
  To: gcc-bugs

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

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

https://gcc.gnu.org/g:2168bfb81448ae1bfa4351760a23d4ec051c2a00

commit r12-1827-g2168bfb81448ae1bfa4351760a23d4ec051c2a00
Author: Jason Merrill <jason@redhat.com>
Date:   Thu Jun 24 17:32:02 2021 -0400

    c++: constexpr aggr init of empty class [PR101040]

    This is basically the aggregate initializer version of PR97566; as in that
    bug, we are trying to initialize empty field 'obj' in 'single' when there's
    no CONSTRUCTOR entry for the 'single' base class subobject of 'derived'. 
As
    with that bug, the fix is to stop trying to add entries for empty fields,
    this time in cxx_eval_bare_aggregate.

    The change to the other function isn't necessary for this version of
    the patch, but seems worthwhile for robustness anyway.

            PR c++/101040
            PR c++/97566

    gcc/cp/ChangeLog:

            * class.c (is_empty_field): Handle null argument.
            * constexpr.c (cxx_eval_bare_aggregate): Discard initializer
            for empty field.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp2a/no_unique_address13.C: New test.

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

* [Bug c++/101040] [11/12 Regression] Internal compiler error: in get_or_insert_ctor_field, at cp/constexpr.c:3571 since r11-7980-gc3d3bb0f03dbd025
  2021-06-12 11:36 [Bug c++/101040] New: [11 Regression] Internal compiler error: in get_or_insert_ctor_field, at cp/constexpr.c:3571 git at foonathan dot net
                   ` (3 preceding siblings ...)
  2021-06-26  4:13 ` cvs-commit at gcc dot gnu.org
@ 2021-06-26  4:16 ` jason at gcc dot gnu.org
  2021-07-07 21:36 ` cvs-commit at gcc dot gnu.org
  2021-07-07 22:52 ` jason at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: jason at gcc dot gnu.org @ 2021-06-26  4:16 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> ---
Created attachment 51060
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51060&action=edit
bits dropped from the patch

putting these here in case I want them later.

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

* [Bug c++/101040] [11/12 Regression] Internal compiler error: in get_or_insert_ctor_field, at cp/constexpr.c:3571 since r11-7980-gc3d3bb0f03dbd025
  2021-06-12 11:36 [Bug c++/101040] New: [11 Regression] Internal compiler error: in get_or_insert_ctor_field, at cp/constexpr.c:3571 git at foonathan dot net
                   ` (4 preceding siblings ...)
  2021-06-26  4:16 ` jason at gcc dot gnu.org
@ 2021-07-07 21:36 ` cvs-commit at gcc dot gnu.org
  2021-07-07 22:52 ` jason at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-07-07 21:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from CVS 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:38fed4dfa25ac4894546f0589340ebfc5eef3bee

commit r11-8704-g38fed4dfa25ac4894546f0589340ebfc5eef3bee
Author: Jason Merrill <jason@redhat.com>
Date:   Thu Jun 24 17:32:02 2021 -0400

    c++: constexpr aggr init of empty class [PR101040]

    This is basically the aggregate initializer version of PR97566; as in that
    bug, we are trying to initialize empty field 'obj' in 'single' when there's
    no CONSTRUCTOR entry for the 'single' base class subobject of 'derived'. 
As
    with that bug, the fix is to stop trying to add entries for empty fields,
    this time in cxx_eval_bare_aggregate.

    The change to the other function isn't necessary for this version of
    the patch, but seems worthwhile for robustness anyway.

            PR c++/101040
            PR c++/97566

    gcc/cp/ChangeLog:

            * class.c (is_empty_field): Handle null argument.
            * constexpr.c (cxx_eval_bare_aggregate): Discard initializer
            for empty field.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp2a/no_unique_address13.C: New test.

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

* [Bug c++/101040] [11/12 Regression] Internal compiler error: in get_or_insert_ctor_field, at cp/constexpr.c:3571 since r11-7980-gc3d3bb0f03dbd025
  2021-06-12 11:36 [Bug c++/101040] New: [11 Regression] Internal compiler error: in get_or_insert_ctor_field, at cp/constexpr.c:3571 git at foonathan dot net
                   ` (5 preceding siblings ...)
  2021-07-07 21:36 ` cvs-commit at gcc dot gnu.org
@ 2021-07-07 22:52 ` jason at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: jason at gcc dot gnu.org @ 2021-07-07 22:52 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #5 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed for 11.2/12.

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

end of thread, other threads:[~2021-07-07 22:52 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-12 11:36 [Bug c++/101040] New: [11 Regression] Internal compiler error: in get_or_insert_ctor_field, at cp/constexpr.c:3571 git at foonathan dot net
2021-06-14  6:48 ` [Bug c++/101040] " rguenth at gcc dot gnu.org
2021-06-14  8:40 ` [Bug c++/101040] [11/12 Regression] Internal compiler error: in get_or_insert_ctor_field, at cp/constexpr.c:3571 since r11-7980-gc3d3bb0f03dbd025 marxin at gcc dot gnu.org
2021-06-21 18:04 ` jason at gcc dot gnu.org
2021-06-26  4:13 ` cvs-commit at gcc dot gnu.org
2021-06-26  4:16 ` jason at gcc dot gnu.org
2021-07-07 21:36 ` cvs-commit at gcc dot gnu.org
2021-07-07 22:52 ` 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).