public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/102871] New: ICE in unify, at cp/pt.c:23752 since r7-4431-g4a826ca6feb3c7ec
@ 2021-10-21  7:50 marxin at gcc dot gnu.org
  2021-10-21  9:06 ` [Bug c++/102871] " pinskia at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-10-21  7:50 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 102871
           Summary: ICE in unify, at cp/pt.c:23752 since
                    r7-4431-g4a826ca6feb3c7ec
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marxin at gcc dot gnu.org
                CC: jason at redhat dot com
  Target Milestone: ---

The following valid code (accepted by clang) crashes:

$ cat deduction.cpp
template <auto> struct X {};
template <typename T, typename... Ts> struct A {
  template <Ts... Ns, T... Ps> A(X<Ps...>, Ts (*...qs)[Ns]);
};
int arr2;
short arr3[1];
A a(X<&arr2>{}, &arr3);

$ g++ deduction.cpp -c
deduction.cpp: In substitution of ‘template<Ts ...Ns, int* ...Ps> A<int*, short
int>::A(X<Ps ...>, Ts (*)[Ns]...) [with Ts ...Ns = <missing>; int* ...Ps = {(&
arr2)}]’:
deduction.cpp:7:22:   required from here
deduction.cpp:7:22: internal compiler error: in unify, at cp/pt.c:23752
    7 | A a(X<&arr2>{}, &arr3);
      |                      ^
0x736bcd unify
        /home/marxin/Programming/gcc/gcc/cp/pt.c:23752
0xba9501 unify
        /home/marxin/Programming/gcc/gcc/cp/pt.c:24030
0xba8fa9 unify
        /home/marxin/Programming/gcc/gcc/cp/pt.c:24014
0xba6403 unify_one_argument
        /home/marxin/Programming/gcc/gcc/cp/pt.c:22288
0xba7151 unify_pack_expansion
        /home/marxin/Programming/gcc/gcc/cp/pt.c:23335
0xbc0142 type_unification_real
        /home/marxin/Programming/gcc/gcc/cp/pt.c:22431
0xbcf6d9 fn_type_unification(tree_node*, tree_node*, tree_node*, tree_node*
const*, unsigned int, tree_node*, unification_kind_t, int, conversion**, bool,
bool)
        /home/marxin/Programming/gcc/gcc/cp/pt.c:21739
0x9bbd41 add_template_candidate_real
        /home/marxin/Programming/gcc/gcc/cp/call.c:3548
0x9bce0b add_template_candidate
        /home/marxin/Programming/gcc/gcc/cp/call.c:3636
0x9bce0b add_candidates
        /home/marxin/Programming/gcc/gcc/cp/call.c:6193
0x9c3bfb add_candidates
        /home/marxin/Programming/gcc/gcc/cp/call.c:6079
0x9c3bfb build_new_method_call_1
        /home/marxin/Programming/gcc/gcc/cp/call.c:10874
0x9c3bfb build_new_method_call(tree_node*, tree_node*, vec<tree_node*, va_gc,
vl_embed>**, tree_node*, int, tree_node**, int)
        /home/marxin/Programming/gcc/gcc/cp/call.c:11084
0x9c52e3 build_special_member_call(tree_node*, tree_node*, vec<tree_node*,
va_gc, vl_embed>**, tree_node*, int, int)
        /home/marxin/Programming/gcc/gcc/cp/call.c:10484
0xaa5a9b expand_default_init
        /home/marxin/Programming/gcc/gcc/cp/init.c:2015
0xaa5a9b expand_aggr_init_1
        /home/marxin/Programming/gcc/gcc/cp/init.c:2134
0xaa83ff build_aggr_init(tree_node*, tree_node*, int, int)
        /home/marxin/Programming/gcc/gcc/cp/init.c:1853
0xa4ea24 build_aggr_init_full_exprs
        /home/marxin/Programming/gcc/gcc/cp/decl.c:7052
0xa4ea24 check_initializer
        /home/marxin/Programming/gcc/gcc/cp/decl.c:7213
0xa7638a cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int)
        /home/marxin/Programming/gcc/gcc/cp/decl.c:8216
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.

Likely started with r7-4431-g4a826ca6feb3c7ec.

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

* [Bug c++/102871] ICE in unify, at cp/pt.c:23752 since r7-4431-g4a826ca6feb3c7ec
  2021-10-21  7:50 [Bug c++/102871] New: ICE in unify, at cp/pt.c:23752 since r7-4431-g4a826ca6feb3c7ec marxin at gcc dot gnu.org
@ 2021-10-21  9:06 ` pinskia at gcc dot gnu.org
  2021-11-08  9:20 ` pinskia at gcc dot gnu.org
  2021-11-08  9:24 ` [Bug c++/102871] ICE in unify, at cp/pt.c:23752 with arrays and varagrs template pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-10-21  9:06 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=84822

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Might be related to PR 84822.

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

* [Bug c++/102871] ICE in unify, at cp/pt.c:23752 since r7-4431-g4a826ca6feb3c7ec
  2021-10-21  7:50 [Bug c++/102871] New: ICE in unify, at cp/pt.c:23752 since r7-4431-g4a826ca6feb3c7ec marxin at gcc dot gnu.org
  2021-10-21  9:06 ` [Bug c++/102871] " pinskia at gcc dot gnu.org
@ 2021-11-08  9:20 ` pinskia at gcc dot gnu.org
  2021-11-08  9:24 ` [Bug c++/102871] ICE in unify, at cp/pt.c:23752 with arrays and varagrs template pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-11-08  9:20 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-11-08
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Reduced testcase removing the auto and a few other template arguments and
making it valid C++11 code:
short arr3[1];
template <typename... Ts> struct A {
  template <Ts... Ns> A(Ts (*...qs)[Ns]);
};
A<short> a(&arr3);
------- CUT ------
The above testcase ICEs all the way down to GCC 4.8.0, before it was rejected
with:
<source>:5:17: error: no matching function for call to 'A<short int>::A(short
int (*)[1])'
<source>:5:17: note: candidates are:
<source>:3:23: note: template<Ts ...Ns> A::A(Ts (*)[Ns]...)
<source>:3:23: note:   template argument deduction/substitution failed:
<source>:5:17: note:   'Ns' is not equivalent to '1'
<source>:2:34: note: constexpr A<short int>::A(const A<short int>&)
<source>:2:34: note:   no known conversion for argument 1 from 'short int
(*)[1]' to 'const A<short int>&'
<source>:2:34: note: constexpr A<short int>::A(A<short int>&&)
<source>:2:34: note:   no known conversion for argument 1 from 'short int
(*)[1]' to 'A<short int>&&'

Note the revision referenced was just dealing with the first line of the code
which you can replace the auto with int* and get a failure earlier too.

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

* [Bug c++/102871] ICE in unify, at cp/pt.c:23752 with arrays and varagrs template
  2021-10-21  7:50 [Bug c++/102871] New: ICE in unify, at cp/pt.c:23752 since r7-4431-g4a826ca6feb3c7ec marxin at gcc dot gnu.org
  2021-10-21  9:06 ` [Bug c++/102871] " pinskia at gcc dot gnu.org
  2021-11-08  9:20 ` pinskia at gcc dot gnu.org
@ 2021-11-08  9:24 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-11-08  9:24 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |DUPLICATE

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup of bug 57527.  The problem is the nested variadic templates.

*** This bug has been marked as a duplicate of bug 57527 ***

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

end of thread, other threads:[~2021-11-08  9:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-21  7:50 [Bug c++/102871] New: ICE in unify, at cp/pt.c:23752 since r7-4431-g4a826ca6feb3c7ec marxin at gcc dot gnu.org
2021-10-21  9:06 ` [Bug c++/102871] " pinskia at gcc dot gnu.org
2021-11-08  9:20 ` pinskia at gcc dot gnu.org
2021-11-08  9:24 ` [Bug c++/102871] ICE in unify, at cp/pt.c:23752 with arrays and varagrs template 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).