public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/105589] New: [ICE] templated type alias over std::array with bound type in template function fails
@ 2022-05-13  1:25 cuzdav at gmail dot com
  2022-05-13  7:57 ` [Bug c++/105589] [12/13 Regression] " rguenth at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: cuzdav at gmail dot com @ 2022-05-13  1:25 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 105589
           Summary: [ICE] templated type alias over std::array with bound
                    type in template function fails
           Product: gcc
           Version: 12.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: cuzdav at gmail dot com
  Target Milestone: ---

Created attachment 52969
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52969&action=edit
preprocessed code

Internal compiler error - new in gcc12

COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/opt/imc/gcc-12.1.0/libexec/gcc/x86_64-pc-linux-gnu/12.1.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-12.1.0/configure --prefix=/opt/imc/gcc-12.1.0
--enable-languages=c,c++,fortran,lto --disable-multilib
--with-build-time-tools=/home/trading/cuzdav/code/imc-gcc/gcc/12.1.0/INSTALLDIR//opt/imc/gcc-12.1.0/bin
--enable-libstdcxx-time=rt
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.1.0 (GCC) 


Spent a long time minimizing it to this example, so it's contrived but small. 

The user-provided constructor in the element type seems related.
The auto parameter in form() is also necessary, even if unused.

///////////////////////////////////////////////
#include <array>

struct X {
    X() {}
};

template<int N>
using C = std::array<X, N>;

void form(auto) {
  auto w = C<16>{};
}
///////////////////////////////////////////////

LIVE:
(Also visible on the 12.1 on godbolt)
https://godbolt.org/z/qWba56onf

OUTPUT:
foo2.cpp: In function ‘void form(auto:3)’:
foo2.cpp:11:18: internal compiler error: in build_value_init, at cp/init.cc:347
   11 |   auto w = C<16>{};
      |                  ^
0x1b1211a diagnostic_impl(rich_location*, diagnostic_metadata const*, int, char
const*, __va_list_tag (*) [1], diagnostic_t)
        ???:0
0x13637ff internal_error(char const*, ...)
        ???:0
0x13638d1 fancy_abort(char const*, int, char const*)
        ???:0
0x7665e6 build_value_init(tree_node*, int) [clone .cold]
        ???:0
0x1901bb1 build_vec_init_expr(tree_node*, tree_node*, int)
        ???:0
0x809217 digest_init_r(tree_node*, tree_node*, int, int, int) [clone .cold]
        ???:0
0x157c0ca massage_init_elt(tree_node*, tree_node*, int, int, int)
        ???:0
0x8096e7 digest_init_r(tree_node*, tree_node*, int, int, int) [clone .cold]
        ???:0
0x18ff96c finish_compound_literal(tree_node*, tree_node*, int, fcl_t)
        ???:0
0x15453de cp_parser_functional_cast(cp_parser*, tree_node*)
        ???:0
0x153e4ac cp_parser_postfix_expression(cp_parser*, bool, bool, bool, bool,
cp_id_kind*)
        ???:0
0x153c5dc cp_parser_binary_expression(cp_parser*, bool, bool, bool,
cp_parser_prec, cp_id_kind*)
        ???:0
0x153c2b2 cp_parser_assignment_expression(cp_parser*, cp_id_kind*, bool, bool)
        ???:0
0x153c130 cp_parser_constant_expression(cp_parser*, int, bool*, bool)
        ???:0
0x153bf7b cp_parser_initializer(cp_parser*, bool*, bool*, bool)
        ???:0
0x7a2ea4 cp_parser_init_declarator(cp_parser*, int, cp_decl_specifier_seq*,
vec<deferred_access_check, va_gc, vl_embed>*, bool, bool, int, bool*,
tree_node**, unsigned int*, tree_node**) [clone .cold]
        ???:0
0x15300c5 cp_parser_simple_declaration(cp_parser*, bool, tree_node**)
        ???:0
0x1542170 cp_parser_declaration_statement(cp_parser*)
        ???:0
0x1540bf3 cp_parser_statement(cp_parser*, tree_node*, bool, bool*,
vec<tree_node*, va_heap, vl_ptr>*, unsigned int*)
        ???:0
0x1540657 cp_parser_compound_statement(cp_parser*, tree_node*, int, bool)
        ???: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.


Preprocessed code attached.

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

* [Bug c++/105589] [12/13 Regression] [ICE] templated type alias over std::array with bound type in template function fails
  2022-05-13  1:25 [Bug c++/105589] New: [ICE] templated type alias over std::array with bound type in template function fails cuzdav at gmail dot com
@ 2022-05-13  7:57 ` rguenth at gcc dot gnu.org
  2022-05-13 13:28 ` ppalka at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-05-13  7:57 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[ICE] templated type alias  |[12/13 Regression] [ICE]
                   |over std::array with bound  |templated type alias over
                   |type in template function   |std::array with bound type
                   |fails                       |in template function fails
           Keywords|                            |ice-on-valid-code
   Target Milestone|---                         |12.2

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

* [Bug c++/105589] [12/13 Regression] [ICE] templated type alias over std::array with bound type in template function fails
  2022-05-13  1:25 [Bug c++/105589] New: [ICE] templated type alias over std::array with bound type in template function fails cuzdav at gmail dot com
  2022-05-13  7:57 ` [Bug c++/105589] [12/13 Regression] " rguenth at gcc dot gnu.org
@ 2022-05-13 13:28 ` ppalka at gcc dot gnu.org
  2022-05-13 19:56 ` jason at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-05-13 13:28 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu.org,
                   |                            |ppalka at gcc dot gnu.org
   Last reconfirmed|                            |2022-05-13
     Ever confirmed|0                           |1
      Known to fail|                            |12.1.0, 13.0
      Known to work|                            |11.3.0
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Started with r12-8066-g4822108e61ab87.

struct X { X(); };

struct array { X m[2]; };

template<class>
void f() {
  array w = array{};
}

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

* [Bug c++/105589] [12/13 Regression] [ICE] templated type alias over std::array with bound type in template function fails
  2022-05-13  1:25 [Bug c++/105589] New: [ICE] templated type alias over std::array with bound type in template function fails cuzdav at gmail dot com
  2022-05-13  7:57 ` [Bug c++/105589] [12/13 Regression] " rguenth at gcc dot gnu.org
  2022-05-13 13:28 ` ppalka at gcc dot gnu.org
@ 2022-05-13 19:56 ` jason at gcc dot gnu.org
  2022-05-15 16:24 ` jason at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jason at gcc dot gnu.org @ 2022-05-13 19:56 UTC (permalink / raw)
  To: gcc-bugs

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

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

* [Bug c++/105589] [12/13 Regression] [ICE] templated type alias over std::array with bound type in template function fails
  2022-05-13  1:25 [Bug c++/105589] New: [ICE] templated type alias over std::array with bound type in template function fails cuzdav at gmail dot com
                   ` (2 preceding siblings ...)
  2022-05-13 19:56 ` jason at gcc dot gnu.org
@ 2022-05-15 16:24 ` jason at gcc dot gnu.org
  2022-05-15 16:25 ` jason at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jason at gcc dot gnu.org @ 2022-05-15 16:24 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1
           Keywords|                            |patch

--- Comment #2 from Jason Merrill <jason at gcc dot gnu.org> ---
https://gcc.gnu.org/pipermail/gcc-patches/2022-May/594135.html

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

* [Bug c++/105589] [12/13 Regression] [ICE] templated type alias over std::array with bound type in template function fails
  2022-05-13  1:25 [Bug c++/105589] New: [ICE] templated type alias over std::array with bound type in template function fails cuzdav at gmail dot com
                   ` (3 preceding siblings ...)
  2022-05-15 16:24 ` jason at gcc dot gnu.org
@ 2022-05-15 16:25 ` jason at gcc dot gnu.org
  2022-05-15 16:28 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jason at gcc dot gnu.org @ 2022-05-15 16:25 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|patch                       |

--- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> ---
(In reply to Jason Merrill from comment #2)
> https://gcc.gnu.org/pipermail/gcc-patches/2022-May/594135.html

Oops, wrong PR.

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

* [Bug c++/105589] [12/13 Regression] [ICE] templated type alias over std::array with bound type in template function fails
  2022-05-13  1:25 [Bug c++/105589] New: [ICE] templated type alias over std::array with bound type in template function fails cuzdav at gmail dot com
                   ` (4 preceding siblings ...)
  2022-05-15 16:25 ` jason at gcc dot gnu.org
@ 2022-05-15 16:28 ` cvs-commit at gcc dot gnu.org
  2022-05-15 16:29 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-05-15 16:28 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 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:ce46d6041358052dfa26f3720732f0357c5d72e7

commit r13-463-gce46d6041358052dfa26f3720732f0357c5d72e7
Author: Jason Merrill <jason@redhat.com>
Date:   Fri May 13 16:07:10 2022 -0400

    c++: array {}-init [PR105589]

    My patch for 105191 made us use build_value_init more frequently from
    build_vec_init_expr, but build_value_init doesn't like to be called to
    initialize a class in a template.  That's caused trouble in the past, and
    seems like a strange restriction, so let's fix it.

            PR c++/105589
            PR c++/105191
            PR c++/92385

    gcc/cp/ChangeLog:

            * init.cc (build_value_init): Handle class in template.

    gcc/testsuite/ChangeLog:

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

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

* [Bug c++/105589] [12/13 Regression] [ICE] templated type alias over std::array with bound type in template function fails
  2022-05-13  1:25 [Bug c++/105589] New: [ICE] templated type alias over std::array with bound type in template function fails cuzdav at gmail dot com
                   ` (5 preceding siblings ...)
  2022-05-15 16:28 ` cvs-commit at gcc dot gnu.org
@ 2022-05-15 16:29 ` cvs-commit at gcc dot gnu.org
  2022-05-15 16:29 ` jason at gcc dot gnu.org
  2022-10-04 18:25 ` pinskia at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-05-15 16:29 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 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:40f749b364b740f41ea6b211f81c21919a2e8bee

commit r12-8380-g40f749b364b740f41ea6b211f81c21919a2e8bee
Author: Jason Merrill <jason@redhat.com>
Date:   Fri May 13 16:07:10 2022 -0400

    c++: array {}-init [PR105589]

    My patch for 105191 made us use build_value_init more frequently from
    build_vec_init_expr, but build_value_init doesn't like to be called to
    initialize a class in a template.  That's caused trouble in the past, and
    seems like a strange restriction, so let's fix it.

            PR c++/105589
            PR c++/105191
            PR c++/92385

    gcc/cp/ChangeLog:

            * init.cc (build_value_init): Handle class in template.

    gcc/testsuite/ChangeLog:

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

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

* [Bug c++/105589] [12/13 Regression] [ICE] templated type alias over std::array with bound type in template function fails
  2022-05-13  1:25 [Bug c++/105589] New: [ICE] templated type alias over std::array with bound type in template function fails cuzdav at gmail dot com
                   ` (6 preceding siblings ...)
  2022-05-15 16:29 ` cvs-commit at gcc dot gnu.org
@ 2022-05-15 16:29 ` jason at gcc dot gnu.org
  2022-10-04 18:25 ` pinskia at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: jason at gcc dot gnu.org @ 2022-05-15 16:29 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #6 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed for 12.2/13.

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

* [Bug c++/105589] [12/13 Regression] [ICE] templated type alias over std::array with bound type in template function fails
  2022-05-13  1:25 [Bug c++/105589] New: [ICE] templated type alias over std::array with bound type in template function fails cuzdav at gmail dot com
                   ` (7 preceding siblings ...)
  2022-05-15 16:29 ` jason at gcc dot gnu.org
@ 2022-10-04 18:25 ` pinskia at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-10-04 18:25 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tim at klingt dot org

--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 107146 has been marked as a duplicate of this bug. ***

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

end of thread, other threads:[~2022-10-04 18:25 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-13  1:25 [Bug c++/105589] New: [ICE] templated type alias over std::array with bound type in template function fails cuzdav at gmail dot com
2022-05-13  7:57 ` [Bug c++/105589] [12/13 Regression] " rguenth at gcc dot gnu.org
2022-05-13 13:28 ` ppalka at gcc dot gnu.org
2022-05-13 19:56 ` jason at gcc dot gnu.org
2022-05-15 16:24 ` jason at gcc dot gnu.org
2022-05-15 16:25 ` jason at gcc dot gnu.org
2022-05-15 16:28 ` cvs-commit at gcc dot gnu.org
2022-05-15 16:29 ` cvs-commit at gcc dot gnu.org
2022-05-15 16:29 ` jason at gcc dot gnu.org
2022-10-04 18:25 ` pinskia 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).