public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/98295] New: [9/10/11 Regression] ICE in verify_ctor_sanity,  at cp/constexpr.c:4312
@ 2020-12-15 17:21 gscfq@t-online.de
  2020-12-15 18:20 ` [Bug c++/98295] " mpolacek at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: gscfq@t-online.de @ 2020-12-15 17:21 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 98295
           Summary: [9/10/11 Regression] ICE in verify_ctor_sanity, at
                    cp/constexpr.c:4312
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gscfq@t-online.de
  Target Milestone: ---

Affects versions down to r7 :


$ cat z1.cc
struct A { constexpr A(); };
void f ()
{
  A b[2][3];
  [b] {};
}


$ g++-11-20201213 -c z1.cc
z1.cc: In function 'void f()':
z1.cc:5:3: internal compiler error: in verify_ctor_sanity, at
cp/constexpr.c:4312
    5 |   [b] {};
      |   ^~~~~~
0x67c29d verify_ctor_sanity
        ../../gcc/cp/constexpr.c:4306
0x689c3c cxx_eval_bare_aggregate
        ../../gcc/cp/constexpr.c:4342
0x681259 cxx_eval_constant_expression
        ../../gcc/cp/constexpr.c:6574
0x682adc cxx_eval_array_reference
        ../../gcc/cp/constexpr.c:3763
0x682adc cxx_eval_constant_expression
        ../../gcc/cp/constexpr.c:6498
0x681041 cxx_eval_array_reference
        ../../gcc/cp/constexpr.c:3659
0x681041 cxx_eval_constant_expression
        ../../gcc/cp/constexpr.c:6498
0x6833cd cxx_eval_constant_expression
        ../../gcc/cp/constexpr.c:6205
0x68a33a cxx_eval_vec_init_1
        ../../gcc/cp/constexpr.c:4548
0x68a417 cxx_eval_vec_init_1
        ../../gcc/cp/constexpr.c:4524
0x681d76 cxx_eval_vec_init
        ../../gcc/cp/constexpr.c:4599
0x681d76 cxx_eval_constant_expression
        ../../gcc/cp/constexpr.c:6584
0x683eab cxx_eval_outermost_constant_expr
        ../../gcc/cp/constexpr.c:7126
0x686e7f maybe_constant_init_1
        ../../gcc/cp/constexpr.c:7578
0x7db5ce massage_init_elt
        ../../gcc/cp/typeck2.c:1309
0x7da80f process_init_constructor_record
        ../../gcc/cp/typeck2.c:1528
0x7da80f process_init_constructor
        ../../gcc/cp/typeck2.c:1806
0x7da80f digest_init_r
        ../../gcc/cp/typeck2.c:1195
0x7a0e36 finish_compound_literal(tree_node*, tree_node*, int, fcl_t)
        ../../gcc/cp/semantics.c:3001
0x6f1074 build_lambda_object(tree_node*)
        ../../gcc/cp/lambda.c:118

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

* [Bug c++/98295] [9/10/11 Regression] ICE in verify_ctor_sanity, at cp/constexpr.c:4312
  2020-12-15 17:21 [Bug c++/98295] New: [9/10/11 Regression] ICE in verify_ctor_sanity, at cp/constexpr.c:4312 gscfq@t-online.de
@ 2020-12-15 18:20 ` mpolacek at gcc dot gnu.org
  2020-12-15 18:26 ` [Bug c++/98295] [8/9/10/11 " mpolacek at gcc dot gnu.org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-12-15 18:20 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2020-12-15
     Ever confirmed|0                           |1
                 CC|                            |mpolacek at gcc dot gnu.org

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Confirmed.  A vs. A[3] mismatch.

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

* [Bug c++/98295] [8/9/10/11 Regression] ICE in verify_ctor_sanity, at cp/constexpr.c:4312
  2020-12-15 17:21 [Bug c++/98295] New: [9/10/11 Regression] ICE in verify_ctor_sanity, at cp/constexpr.c:4312 gscfq@t-online.de
  2020-12-15 18:20 ` [Bug c++/98295] " mpolacek at gcc dot gnu.org
@ 2020-12-15 18:26 ` mpolacek at gcc dot gnu.org
  2021-01-04 15:15 ` rguenth at gcc dot gnu.org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-12-15 18:26 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |8.5
           Keywords|                            |ice-on-valid-code
            Summary|[9/10/11 Regression] ICE in |[8/9/10/11 Regression] ICE
                   |verify_ctor_sanity, at      |in verify_ctor_sanity, at
                   |cp/constexpr.c:4312         |cp/constexpr.c:4312

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Started with r239267.

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

* [Bug c++/98295] [8/9/10/11 Regression] ICE in verify_ctor_sanity, at cp/constexpr.c:4312
  2020-12-15 17:21 [Bug c++/98295] New: [9/10/11 Regression] ICE in verify_ctor_sanity, at cp/constexpr.c:4312 gscfq@t-online.de
  2020-12-15 18:20 ` [Bug c++/98295] " mpolacek at gcc dot gnu.org
  2020-12-15 18:26 ` [Bug c++/98295] [8/9/10/11 " mpolacek at gcc dot gnu.org
@ 2021-01-04 15:15 ` rguenth at gcc dot gnu.org
  2021-01-21 11:56 ` jakub at gcc dot gnu.org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-01-04 15:15 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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

* [Bug c++/98295] [8/9/10/11 Regression] ICE in verify_ctor_sanity, at cp/constexpr.c:4312
  2020-12-15 17:21 [Bug c++/98295] New: [9/10/11 Regression] ICE in verify_ctor_sanity, at cp/constexpr.c:4312 gscfq@t-online.de
                   ` (2 preceding siblings ...)
  2021-01-04 15:15 ` rguenth at gcc dot gnu.org
@ 2021-01-21 11:56 ` jakub at gcc dot gnu.org
  2021-01-27 16:56 ` jakub at gcc dot gnu.org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-01-21 11:56 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Perhaps related to PR98463 ?

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

* [Bug c++/98295] [8/9/10/11 Regression] ICE in verify_ctor_sanity, at cp/constexpr.c:4312
  2020-12-15 17:21 [Bug c++/98295] New: [9/10/11 Regression] ICE in verify_ctor_sanity, at cp/constexpr.c:4312 gscfq@t-online.de
                   ` (3 preceding siblings ...)
  2021-01-21 11:56 ` jakub at gcc dot gnu.org
@ 2021-01-27 16:56 ` jakub at gcc dot gnu.org
  2021-01-27 18:54 ` ppalka at gcc dot gnu.org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-01-27 16:56 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Still ICEs even when that other bug is fixed.

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

* [Bug c++/98295] [8/9/10/11 Regression] ICE in verify_ctor_sanity, at cp/constexpr.c:4312
  2020-12-15 17:21 [Bug c++/98295] New: [9/10/11 Regression] ICE in verify_ctor_sanity, at cp/constexpr.c:4312 gscfq@t-online.de
                   ` (4 preceding siblings ...)
  2021-01-27 16:56 ` jakub at gcc dot gnu.org
@ 2021-01-27 18:54 ` ppalka at gcc dot gnu.org
  2021-02-01 15:29 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-01-27 18:54 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

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

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

* [Bug c++/98295] [8/9/10/11 Regression] ICE in verify_ctor_sanity, at cp/constexpr.c:4312
  2020-12-15 17:21 [Bug c++/98295] New: [9/10/11 Regression] ICE in verify_ctor_sanity, at cp/constexpr.c:4312 gscfq@t-online.de
                   ` (5 preceding siblings ...)
  2021-01-27 18:54 ` ppalka at gcc dot gnu.org
@ 2021-02-01 15:29 ` cvs-commit at gcc dot gnu.org
  2021-02-01 15:30 ` [Bug c++/98295] [8/9/10 " ppalka at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-02-01 15:29 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>:

https://gcc.gnu.org/g:7e534fb7d8256a605b6bdc12451d209af1bed329

commit r11-7013-g7e534fb7d8256a605b6bdc12451d209af1bed329
Author: Patrick Palka <ppalka@redhat.com>
Date:   Mon Feb 1 10:27:45 2021 -0500

    c++: Fix ICE from verify_ctor_sanity [PR98295]

    In this testcase we're crashing during constexpr evaluation of the
    ARRAY_REF b[0] as part of evaluation of the lambda's by-copy capture of b
    (which is encoded as a VEC_INIT_EXPR<b>).  Since A's constexpr default
    constructor is not yet defined, b's initialization is not actually
    constant, but because A is an empty type, evaluation of b from
    cxx_eval_array_ref is successful and yields an empty CONSTRUCTOR.
    And since this CONSTRUCTOR is empty, we {}-initialize the desired array
    element, and end up crashing from verify_ctor_sanity during evaluation
    of this initializer because we updated new_ctx.ctor without updating
    new_ctx.object: the former now has type A[3] and the latter is still the
    target of a TARGET_EXPR for b[0][0] created from cxx_eval_vec_init
    (and so has type A).

    This patch fixes this by setting new_ctx.object appropriately at the
    same time that we set new_ctx.ctor from cxx_eval_array_reference.

    gcc/cp/ChangeLog:

            PR c++/98295
            * constexpr.c (cxx_eval_array_reference): Also set
            new_ctx.object when setting new_ctx.ctor.

    gcc/testsuite/ChangeLog:

            PR c++/98295
            * g++.dg/cpp0x/constexpr-98295.C: New test.

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

* [Bug c++/98295] [8/9/10 Regression] ICE in verify_ctor_sanity, at cp/constexpr.c:4312
  2020-12-15 17:21 [Bug c++/98295] New: [9/10/11 Regression] ICE in verify_ctor_sanity, at cp/constexpr.c:4312 gscfq@t-online.de
                   ` (6 preceding siblings ...)
  2021-02-01 15:29 ` cvs-commit at gcc dot gnu.org
@ 2021-02-01 15:30 ` ppalka at gcc dot gnu.org
  2021-02-02  5:38 ` cvs-commit at gcc dot gnu.org
  2021-02-02 20:11 ` ppalka at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-02-01 15:30 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[8/9/10/11 Regression] ICE  |[8/9/10 Regression] ICE in
                   |in verify_ctor_sanity, at   |verify_ctor_sanity, at
                   |cp/constexpr.c:4312         |cp/constexpr.c:4312

--- Comment #6 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed for GCC 11 so far.  Will probably backport only to the 10 branch.

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

* [Bug c++/98295] [8/9/10 Regression] ICE in verify_ctor_sanity, at cp/constexpr.c:4312
  2020-12-15 17:21 [Bug c++/98295] New: [9/10/11 Regression] ICE in verify_ctor_sanity, at cp/constexpr.c:4312 gscfq@t-online.de
                   ` (7 preceding siblings ...)
  2021-02-01 15:30 ` [Bug c++/98295] [8/9/10 " ppalka at gcc dot gnu.org
@ 2021-02-02  5:38 ` cvs-commit at gcc dot gnu.org
  2021-02-02 20:11 ` ppalka at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-02-02  5:38 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Patrick Palka
<ppalka@gcc.gnu.org>:

https://gcc.gnu.org/g:a4f8e2fc771bea21aaac44433e75510362e208c1

commit r10-9335-ga4f8e2fc771bea21aaac44433e75510362e208c1
Author: Patrick Palka <ppalka@redhat.com>
Date:   Mon Feb 1 10:27:45 2021 -0500

    c++: Fix ICE from verify_ctor_sanity [PR98295]

    In this testcase we're crashing during constexpr evaluation of the
    ARRAY_REF b[0] as part of evaluation of the lambda's by-copy capture of b
    (which is encoded as a VEC_INIT_EXPR<b>).  Since A's constexpr default
    constructor is not yet defined, b's initialization is not actually
    constant, but because A is an empty type, evaluation of b from
    cxx_eval_array_ref is successful and yields an empty CONSTRUCTOR.
    And since this CONSTRUCTOR is empty, we {}-initialize the desired array
    element, and end up crashing from verify_ctor_sanity during evaluation
    of this initializer because we updated new_ctx.ctor without updating
    new_ctx.object: the former now has type A[3] and the latter is still the
    target of a TARGET_EXPR for b[0][0] created from cxx_eval_vec_init
    (and so has type A).

    This patch fixes this by setting new_ctx.object appropriately at the
    same time that we set new_ctx.ctor from cxx_eval_array_reference.

    gcc/cp/ChangeLog:

            PR c++/98295
            * constexpr.c (cxx_eval_array_reference): Also set
            new_ctx.object when setting new_ctx.ctor.

    gcc/testsuite/ChangeLog:

            PR c++/98295
            * g++.dg/cpp0x/constexpr-98295.C: New test.

    (cherry picked from commit 7e534fb7d8256a605b6bdc12451d209af1bed329)

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

* [Bug c++/98295] [8/9/10 Regression] ICE in verify_ctor_sanity, at cp/constexpr.c:4312
  2020-12-15 17:21 [Bug c++/98295] New: [9/10/11 Regression] ICE in verify_ctor_sanity, at cp/constexpr.c:4312 gscfq@t-online.de
                   ` (8 preceding siblings ...)
  2021-02-02  5:38 ` cvs-commit at gcc dot gnu.org
@ 2021-02-02 20:11 ` ppalka at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-02-02 20:11 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

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

--- Comment #8 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed.

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

end of thread, other threads:[~2021-02-02 20:11 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-15 17:21 [Bug c++/98295] New: [9/10/11 Regression] ICE in verify_ctor_sanity, at cp/constexpr.c:4312 gscfq@t-online.de
2020-12-15 18:20 ` [Bug c++/98295] " mpolacek at gcc dot gnu.org
2020-12-15 18:26 ` [Bug c++/98295] [8/9/10/11 " mpolacek at gcc dot gnu.org
2021-01-04 15:15 ` rguenth at gcc dot gnu.org
2021-01-21 11:56 ` jakub at gcc dot gnu.org
2021-01-27 16:56 ` jakub at gcc dot gnu.org
2021-01-27 18:54 ` ppalka at gcc dot gnu.org
2021-02-01 15:29 ` cvs-commit at gcc dot gnu.org
2021-02-01 15:30 ` [Bug c++/98295] [8/9/10 " ppalka at gcc dot gnu.org
2021-02-02  5:38 ` cvs-commit at gcc dot gnu.org
2021-02-02 20:11 ` ppalka 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).