public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/102307] New: internal compiler error: in reshape_init_r, at cp/decl.c:6717
@ 2021-09-13 14:21 jyhgekyfbkjsyebf at protonmail dot ch
  2021-09-13 14:21 ` [Bug c++/102307] " jyhgekyfbkjsyebf at protonmail dot ch
                   ` (14 more replies)
  0 siblings, 15 replies; 16+ messages in thread
From: jyhgekyfbkjsyebf at protonmail dot ch @ 2021-09-13 14:21 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 102307
           Summary: internal compiler error: in reshape_init_r, at
                    cp/decl.c:6717
           Product: gcc
           Version: 11.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jyhgekyfbkjsyebf at protonmail dot ch
  Target Milestone: ---

Created attachment 51449
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51449&action=edit
Minimal reproducible example

The following minimal reproducible example crashes the compiler:

```
#include <array>
template <unsigned N, unsigned M> struct Matrix {
  Matrix(double const (&arr)[N][M]);
  constexpr Matrix(std::array<std::array<double, M>, N> const &arr);
};
int main() { constexpr Matrix<2, 3> mat{{{1.0, 2.0, 3.0}, {4.0, 5.0, 6.0}}}; }
```

Find attached: this example, basic information about compiler and backtrace,
.ii file, .s file.

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

* [Bug c++/102307] internal compiler error: in reshape_init_r, at cp/decl.c:6717
  2021-09-13 14:21 [Bug c++/102307] New: internal compiler error: in reshape_init_r, at cp/decl.c:6717 jyhgekyfbkjsyebf at protonmail dot ch
@ 2021-09-13 14:21 ` jyhgekyfbkjsyebf at protonmail dot ch
  2021-09-13 14:22 ` jyhgekyfbkjsyebf at protonmail dot ch
                   ` (13 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: jyhgekyfbkjsyebf at protonmail dot ch @ 2021-09-13 14:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from jyhgekyfbkjsyebf at protonmail dot ch ---
Created attachment 51450
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51450&action=edit
Compiler info and backtrace

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

* [Bug c++/102307] internal compiler error: in reshape_init_r, at cp/decl.c:6717
  2021-09-13 14:21 [Bug c++/102307] New: internal compiler error: in reshape_init_r, at cp/decl.c:6717 jyhgekyfbkjsyebf at protonmail dot ch
  2021-09-13 14:21 ` [Bug c++/102307] " jyhgekyfbkjsyebf at protonmail dot ch
@ 2021-09-13 14:22 ` jyhgekyfbkjsyebf at protonmail dot ch
  2021-09-13 14:22 ` jyhgekyfbkjsyebf at protonmail dot ch
                   ` (12 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: jyhgekyfbkjsyebf at protonmail dot ch @ 2021-09-13 14:22 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from jyhgekyfbkjsyebf at protonmail dot ch ---
Created attachment 51451
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51451&action=edit
.ii file

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

* [Bug c++/102307] internal compiler error: in reshape_init_r, at cp/decl.c:6717
  2021-09-13 14:21 [Bug c++/102307] New: internal compiler error: in reshape_init_r, at cp/decl.c:6717 jyhgekyfbkjsyebf at protonmail dot ch
  2021-09-13 14:21 ` [Bug c++/102307] " jyhgekyfbkjsyebf at protonmail dot ch
  2021-09-13 14:22 ` jyhgekyfbkjsyebf at protonmail dot ch
@ 2021-09-13 14:22 ` jyhgekyfbkjsyebf at protonmail dot ch
  2021-09-13 15:01 ` jyhgekyfbkjsyebf at protonmail dot ch
                   ` (11 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: jyhgekyfbkjsyebf at protonmail dot ch @ 2021-09-13 14:22 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from jyhgekyfbkjsyebf at protonmail dot ch ---
Created attachment 51452
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51452&action=edit
.s file

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

* [Bug c++/102307] internal compiler error: in reshape_init_r, at cp/decl.c:6717
  2021-09-13 14:21 [Bug c++/102307] New: internal compiler error: in reshape_init_r, at cp/decl.c:6717 jyhgekyfbkjsyebf at protonmail dot ch
                   ` (2 preceding siblings ...)
  2021-09-13 14:22 ` jyhgekyfbkjsyebf at protonmail dot ch
@ 2021-09-13 15:01 ` jyhgekyfbkjsyebf at protonmail dot ch
  2021-09-13 15:32 ` [Bug c++/102307] internal compiler error: in reshape_init_r, at cp/decl.c:6717 since r10-6388-ge98ebda074bf8fc5 marxin at gcc dot gnu.org
                   ` (10 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: jyhgekyfbkjsyebf at protonmail dot ch @ 2021-09-13 15:01 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from jyhgekyfbkjsyebf at protonmail dot ch ---
Created attachment 51453
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51453&action=edit
GDB bt and bt full

Figured out how to run g++ through gdb. Breakpoint is set right on the assert
that is fired. Output of bt and bt full is provided.

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

* [Bug c++/102307] internal compiler error: in reshape_init_r, at cp/decl.c:6717 since r10-6388-ge98ebda074bf8fc5
  2021-09-13 14:21 [Bug c++/102307] New: internal compiler error: in reshape_init_r, at cp/decl.c:6717 jyhgekyfbkjsyebf at protonmail dot ch
                   ` (3 preceding siblings ...)
  2021-09-13 15:01 ` jyhgekyfbkjsyebf at protonmail dot ch
@ 2021-09-13 15:32 ` marxin at gcc dot gnu.org
  2021-09-13 15:34 ` [Bug c++/102307] [10/11/12 Regression] internal compiler error: in reshape_init_r, at cp/decl.c:6717 pinskia at gcc dot gnu.org
                   ` (9 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-09-13 15:32 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2021-09-13
            Summary|internal compiler error: in |internal compiler error: in
                   |reshape_init_r, at          |reshape_init_r, at
                   |cp/decl.c:6717              |cp/decl.c:6717 since
                   |                            |r10-6388-ge98ebda074bf8fc5
             Status|UNCONFIRMED                 |NEW
                 CC|                            |jason at gcc dot gnu.org,
                   |                            |marxin at gcc dot gnu.org

--- Comment #5 from Martin Liška <marxin at gcc dot gnu.org> ---
Started with r10-6388-ge98ebda074bf8fc5. It was rejected before the revision.

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

* [Bug c++/102307] [10/11/12 Regression] internal compiler error: in reshape_init_r, at cp/decl.c:6717
  2021-09-13 14:21 [Bug c++/102307] New: internal compiler error: in reshape_init_r, at cp/decl.c:6717 jyhgekyfbkjsyebf at protonmail dot ch
                   ` (4 preceding siblings ...)
  2021-09-13 15:32 ` [Bug c++/102307] internal compiler error: in reshape_init_r, at cp/decl.c:6717 since r10-6388-ge98ebda074bf8fc5 marxin at gcc dot gnu.org
@ 2021-09-13 15:34 ` pinskia at gcc dot gnu.org
  2021-09-13 15:35 ` [Bug c++/102307] [10/11/12 Regression] internal compiler error: in reshape_init_r since r10-6388-ge98ebda074bf8fc5 pinskia at gcc dot gnu.org
                   ` (8 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-09-13 15:34 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2021-09-13 00:00:00         |
   Target Milestone|---                         |10.4
            Summary|internal compiler error: in |[10/11/12 Regression]
                   |reshape_init_r, at          |internal compiler error: in
                   |cp/decl.c:6717 since        |reshape_init_r, at
                   |r10-6388-ge98ebda074bf8fc5  |cp/decl.c:6717
             Status|NEW                         |UNCONFIRMED
     Ever confirmed|1                           |0

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I think this is invalid code. Making the code aceppted by clang (and ICC), GCC
does not ICE.

GCC 9 just to produce an error message:
<source>: In function 'int main()':
<source>:7:75: error: call to non-'constexpr' function 'Matrix<N,
M>::Matrix(const double (&)[N][M]) [with unsigned int N = 2; unsigned int M =
3]'
    7 | int main() { constexpr Matrix<2, 3> mat{{{1.0, 2.0, 3.0}, {4.0, 5.0,
6.0}}}; }
      |

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

* [Bug c++/102307] [10/11/12 Regression] internal compiler error: in reshape_init_r since r10-6388-ge98ebda074bf8fc5
  2021-09-13 14:21 [Bug c++/102307] New: internal compiler error: in reshape_init_r, at cp/decl.c:6717 jyhgekyfbkjsyebf at protonmail dot ch
                   ` (5 preceding siblings ...)
  2021-09-13 15:34 ` [Bug c++/102307] [10/11/12 Regression] internal compiler error: in reshape_init_r, at cp/decl.c:6717 pinskia at gcc dot gnu.org
@ 2021-09-13 15:35 ` pinskia at gcc dot gnu.org
  2021-09-13 17:57 ` jyhgekyfbkjsyebf at protonmail dot ch
                   ` (7 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-09-13 15:35 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-invalid-code
            Summary|[10/11/12 Regression]       |[10/11/12 Regression]
                   |internal compiler error: in |internal compiler error: in
                   |reshape_init_r, at          |reshape_init_r since
                   |cp/decl.c:6717              |r10-6388-ge98ebda074bf8fc5
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2021-09-13
             Status|UNCONFIRMED                 |NEW

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

* [Bug c++/102307] [10/11/12 Regression] internal compiler error: in reshape_init_r since r10-6388-ge98ebda074bf8fc5
  2021-09-13 14:21 [Bug c++/102307] New: internal compiler error: in reshape_init_r, at cp/decl.c:6717 jyhgekyfbkjsyebf at protonmail dot ch
                   ` (6 preceding siblings ...)
  2021-09-13 15:35 ` [Bug c++/102307] [10/11/12 Regression] internal compiler error: in reshape_init_r since r10-6388-ge98ebda074bf8fc5 pinskia at gcc dot gnu.org
@ 2021-09-13 17:57 ` jyhgekyfbkjsyebf at protonmail dot ch
  2021-09-14  6:51 ` rguenth at gcc dot gnu.org
                   ` (6 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: jyhgekyfbkjsyebf at protonmail dot ch @ 2021-09-13 17:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from jyhgekyfbkjsyebf at protonmail dot ch ---
Note that:

* based on repro: if I add constexpr to the first ctor and provide body, it
will compile without error. Like this:

constexpr Matrix(double const (&arr)[N][M]) {}

* based on repro: if I comment out the second ctor declaration, compiler will
produce an error (instead of a crash). Like this:

// constexpr Matrix(std::array<std::array<double, M>, N> const &arr);

* based on repro: if I add a data member, and
   * provide body to the first ctor, and
       * inside use std::copy to fill the member

the compiler will crash. Like this:

```
#include <algorithm>
#include <array>
template <unsigned N, unsigned M> struct Matrix {
  std::array<double, N * M> mat;
  Matrix(double const (&arr)[N][M]) {
    std::copy(&arr[0][0], &arr[0][0] + N * M, std::begin(mat));
  }
  constexpr Matrix(std::array<std::array<double, M>, N> const &arr);
};
int main() { constexpr Matrix<2, 3> mat{{{1.0, 2.0, 3.0}, {4.0, 5.0, 6.0}}}; }
```

* based on last case: if I replace std::copy call with 2 for loops, and
    * add constexpr to first ctor, and
    * add -std=c++20 flag

the code will compile. Like this:

```
  constexpr Matrix(double const (&arr)[N][M]) {
    for (auto n{0U}; n < N; ++n) {
      for (auto m{0U}; m < M; ++m)
        mat[n * M + m] = arr[n][m];
    }
  }
```

As you can see, the results due to slight changes are all over the place. I
leave it up to you to interpret them. All of the above is reproducible on
godbolt. I only used local gcc to generate backtrace, everything else was
tinkered with there.

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

* [Bug c++/102307] [10/11/12 Regression] internal compiler error: in reshape_init_r since r10-6388-ge98ebda074bf8fc5
  2021-09-13 14:21 [Bug c++/102307] New: internal compiler error: in reshape_init_r, at cp/decl.c:6717 jyhgekyfbkjsyebf at protonmail dot ch
                   ` (7 preceding siblings ...)
  2021-09-13 17:57 ` jyhgekyfbkjsyebf at protonmail dot ch
@ 2021-09-14  6:51 ` rguenth at gcc dot gnu.org
  2022-04-26 15:14 ` jason at gcc dot gnu.org
                   ` (5 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-09-14  6:51 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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

* [Bug c++/102307] [10/11/12 Regression] internal compiler error: in reshape_init_r since r10-6388-ge98ebda074bf8fc5
  2021-09-13 14:21 [Bug c++/102307] New: internal compiler error: in reshape_init_r, at cp/decl.c:6717 jyhgekyfbkjsyebf at protonmail dot ch
                   ` (8 preceding siblings ...)
  2021-09-14  6:51 ` rguenth at gcc dot gnu.org
@ 2022-04-26 15:14 ` jason at gcc dot gnu.org
  2022-05-17 22:09 ` [Bug c++/102307] [10/11/12/13 " cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: jason at gcc dot gnu.org @ 2022-04-26 15:14 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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

* [Bug c++/102307] [10/11/12/13 Regression] internal compiler error: in reshape_init_r since r10-6388-ge98ebda074bf8fc5
  2021-09-13 14:21 [Bug c++/102307] New: internal compiler error: in reshape_init_r, at cp/decl.c:6717 jyhgekyfbkjsyebf at protonmail dot ch
                   ` (9 preceding siblings ...)
  2022-04-26 15:14 ` jason at gcc dot gnu.org
@ 2022-05-17 22:09 ` cvs-commit at gcc dot gnu.org
  2022-05-25 16:59 ` [Bug c++/102307] [10/11/12 " cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-05-17 22:09 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 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:2b0c8377729a3c62a05897136666574ab939aaab

commit r13-576-g2b0c8377729a3c62a05897136666574ab939aaab
Author: Jason Merrill <jason@redhat.com>
Date:   Tue Apr 26 11:15:04 2022 -0400

    c++: constexpr ref to array of array [PR102307]

    The problem here is that first check_initializer calls
    build_aggr_init_full_exprs, which does overload resolution, but then in the
    case of failed constexpr throws away the result and does it again in
    build_functional_cast.  But in the first overload resolution,
    reshape_init_array_1 decided to reuse the inner CONSTRUCTORs because
    tf_error is set, so we know we're committed.  But the second pass gets
    confused by the CONSTRUCTORs with non-init-list types.

    Fixed by avoiding a second pass: instead, pass the call from
build_aggr_init
    to build_cplus_new, which will turn it into a TARGET_EXPR.  I don't bother
    to change the object argument because it will be replaced later in
    simplify_aggr_init_expr.

            PR c++/102307

    gcc/cp/ChangeLog:

            * decl.cc (check_initializer): Use build_cplus_new in case of
            constexpr failure.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp1z/constexpr-array2.C: New test.

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

* [Bug c++/102307] [10/11/12 Regression] internal compiler error: in reshape_init_r since r10-6388-ge98ebda074bf8fc5
  2021-09-13 14:21 [Bug c++/102307] New: internal compiler error: in reshape_init_r, at cp/decl.c:6717 jyhgekyfbkjsyebf at protonmail dot ch
                   ` (10 preceding siblings ...)
  2022-05-17 22:09 ` [Bug c++/102307] [10/11/12/13 " cvs-commit at gcc dot gnu.org
@ 2022-05-25 16:59 ` cvs-commit at gcc dot gnu.org
  2022-05-31 19:31 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-05-25 16:59 UTC (permalink / raw)
  To: gcc-bugs

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

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

https://gcc.gnu.org/g:5022f4af0d1e2f3fdf2bb159d4372ee3cf34b052

commit r10-10760-g5022f4af0d1e2f3fdf2bb159d4372ee3cf34b052
Author: Jason Merrill <jason@redhat.com>
Date:   Tue Apr 26 11:15:04 2022 -0400

    c++: constexpr ref to array of array [PR102307]

    The problem here is that first check_initializer calls
    build_aggr_init_full_exprs, which does overload resolution, but then in the
    case of failed constexpr throws away the result and does it again in
    build_functional_cast.  But in the first overload resolution,
    reshape_init_array_1 decided to reuse the inner CONSTRUCTORs because
    tf_error is set, so we know we're committed.  But the second pass gets
    confused by the CONSTRUCTORs with non-init-list types.

    Fixed by avoiding a second pass: instead, pass the call from
build_aggr_init
    to build_cplus_new, which will turn it into a TARGET_EXPR.  I don't bother
    to change the object argument because it will be replaced later in
    simplify_aggr_init_expr.

            PR c++/102307

    gcc/cp/ChangeLog:

            * decl.c (check_initializer): Use build_cplus_new in case of
            constexpr failure.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp1z/constexpr-array2.C: New test.

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

* [Bug c++/102307] [10/11/12 Regression] internal compiler error: in reshape_init_r since r10-6388-ge98ebda074bf8fc5
  2021-09-13 14:21 [Bug c++/102307] New: internal compiler error: in reshape_init_r, at cp/decl.c:6717 jyhgekyfbkjsyebf at protonmail dot ch
                   ` (11 preceding siblings ...)
  2022-05-25 16:59 ` [Bug c++/102307] [10/11/12 " cvs-commit at gcc dot gnu.org
@ 2022-05-31 19:31 ` cvs-commit at gcc dot gnu.org
  2022-05-31 19:36 ` [Bug c++/102307] [10/11 " cvs-commit at gcc dot gnu.org
  2022-05-31 19:37 ` jason at gcc dot gnu.org
  14 siblings, 0 replies; 16+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-05-31 19:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from CVS 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:a578b17b59651144a7b2737475d993184600a802

commit r12-8440-ga578b17b59651144a7b2737475d993184600a802
Author: Jason Merrill <jason@redhat.com>
Date:   Tue Apr 26 11:15:04 2022 -0400

    c++: constexpr ref to array of array [PR102307]

    The problem here is that first check_initializer calls
    build_aggr_init_full_exprs, which does overload resolution, but then in the
    case of failed constexpr throws away the result and does it again in
    build_functional_cast.  But in the first overload resolution,
    reshape_init_array_1 decided to reuse the inner CONSTRUCTORs because
    tf_error is set, so we know we're committed.  But the second pass gets
    confused by the CONSTRUCTORs with non-init-list types.

    Fixed by avoiding a second pass: instead, pass the call from
build_aggr_init
    to build_cplus_new, which will turn it into a TARGET_EXPR.  I don't bother
    to change the object argument because it will be replaced later in
    simplify_aggr_init_expr.

            PR c++/102307

    gcc/cp/ChangeLog:

            * decl.cc (check_initializer): Use build_cplus_new in case of
            constexpr failure.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp1z/constexpr-array2.C: New test.

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

* [Bug c++/102307] [10/11 Regression] internal compiler error: in reshape_init_r since r10-6388-ge98ebda074bf8fc5
  2021-09-13 14:21 [Bug c++/102307] New: internal compiler error: in reshape_init_r, at cp/decl.c:6717 jyhgekyfbkjsyebf at protonmail dot ch
                   ` (12 preceding siblings ...)
  2022-05-31 19:31 ` cvs-commit at gcc dot gnu.org
@ 2022-05-31 19:36 ` cvs-commit at gcc dot gnu.org
  2022-05-31 19:37 ` jason at gcc dot gnu.org
  14 siblings, 0 replies; 16+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-05-31 19:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #11 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:3c10dc751e8670c7cc02a1b6db9abffb59d2fc42

commit r11-10042-g3c10dc751e8670c7cc02a1b6db9abffb59d2fc42
Author: Jason Merrill <jason@redhat.com>
Date:   Tue Apr 26 11:15:04 2022 -0400

    c++: constexpr ref to array of array [PR102307]

    The problem here is that first check_initializer calls
    build_aggr_init_full_exprs, which does overload resolution, but then in the
    case of failed constexpr throws away the result and does it again in
    build_functional_cast.  But in the first overload resolution,
    reshape_init_array_1 decided to reuse the inner CONSTRUCTORs because
    tf_error is set, so we know we're committed.  But the second pass gets
    confused by the CONSTRUCTORs with non-init-list types.

    Fixed by avoiding a second pass: instead, pass the call from
build_aggr_init
    to build_cplus_new, which will turn it into a TARGET_EXPR.  I don't bother
    to change the object argument because it will be replaced later in
    simplify_aggr_init_expr.

            PR c++/102307

    gcc/cp/ChangeLog:

            * decl.c (check_initializer): Use build_cplus_new in case of
            constexpr failure.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp1z/constexpr-array2.C: New test.

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

* [Bug c++/102307] [10/11 Regression] internal compiler error: in reshape_init_r since r10-6388-ge98ebda074bf8fc5
  2021-09-13 14:21 [Bug c++/102307] New: internal compiler error: in reshape_init_r, at cp/decl.c:6717 jyhgekyfbkjsyebf at protonmail dot ch
                   ` (13 preceding siblings ...)
  2022-05-31 19:36 ` [Bug c++/102307] [10/11 " cvs-commit at gcc dot gnu.org
@ 2022-05-31 19:37 ` jason at gcc dot gnu.org
  14 siblings, 0 replies; 16+ messages in thread
From: jason at gcc dot gnu.org @ 2022-05-31 19:37 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED
      Known to work|                            |10.3.1, 11.3.1

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

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

end of thread, other threads:[~2022-05-31 19:37 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-13 14:21 [Bug c++/102307] New: internal compiler error: in reshape_init_r, at cp/decl.c:6717 jyhgekyfbkjsyebf at protonmail dot ch
2021-09-13 14:21 ` [Bug c++/102307] " jyhgekyfbkjsyebf at protonmail dot ch
2021-09-13 14:22 ` jyhgekyfbkjsyebf at protonmail dot ch
2021-09-13 14:22 ` jyhgekyfbkjsyebf at protonmail dot ch
2021-09-13 15:01 ` jyhgekyfbkjsyebf at protonmail dot ch
2021-09-13 15:32 ` [Bug c++/102307] internal compiler error: in reshape_init_r, at cp/decl.c:6717 since r10-6388-ge98ebda074bf8fc5 marxin at gcc dot gnu.org
2021-09-13 15:34 ` [Bug c++/102307] [10/11/12 Regression] internal compiler error: in reshape_init_r, at cp/decl.c:6717 pinskia at gcc dot gnu.org
2021-09-13 15:35 ` [Bug c++/102307] [10/11/12 Regression] internal compiler error: in reshape_init_r since r10-6388-ge98ebda074bf8fc5 pinskia at gcc dot gnu.org
2021-09-13 17:57 ` jyhgekyfbkjsyebf at protonmail dot ch
2021-09-14  6:51 ` rguenth at gcc dot gnu.org
2022-04-26 15:14 ` jason at gcc dot gnu.org
2022-05-17 22:09 ` [Bug c++/102307] [10/11/12/13 " cvs-commit at gcc dot gnu.org
2022-05-25 16:59 ` [Bug c++/102307] [10/11/12 " cvs-commit at gcc dot gnu.org
2022-05-31 19:31 ` cvs-commit at gcc dot gnu.org
2022-05-31 19:36 ` [Bug c++/102307] [10/11 " cvs-commit at gcc dot gnu.org
2022-05-31 19:37 ` 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).