public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/113584] New: ICE in unify, at cp/pt.cc:24640 with template specialization on 2 matching template template parameter
@ 2024-01-24 15:18 jonathan.poelen at gmail dot com
  2024-01-24 16:15 ` [Bug c++/113584] " mpolacek at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: jonathan.poelen at gmail dot com @ 2024-01-24 15:18 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 113584
           Summary: ICE in unify, at cp/pt.cc:24640 with template
                    specialization on 2 matching template template
                    parameter
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jonathan.poelen at gmail dot com
  Target Milestone: ---

A link that reproduces the problem on godbolt (with trunk which is currently
gcc 14.0): https://godbolt.org/z/Yn7dEG96e

The code compiles with clang. It also compiles if one of the 2 specializations
is deleted.

The output of -freport-bug with a gcc 13.2 (what I have on my computer).

// Target: x86_64-pc-linux-gnu
// Configured with: /build/gcc/src/gcc/configure
--enable-languages=ada,c,c++,d,fortran,go,lto,objc,obj-c++ --enable-bootstrap
--prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man
--infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/
--with-build-config=bootstrap-lto --with-linker-hash-style=gnu
--with-system-zlib --enable-__cxa_atexit --enable-cet=auto
--enable-checking=release --enable-clocale=gnu --enable-default-pie
--enable-default-ssp --enable-gnu-indirect-function --enable-gnu-unique-object
--enable-libstdcxx-backtrace --enable-link-serialization=1
--enable-linker-build-id --enable-lto --enable-multilib --enable-plugin
--enable-shared --enable-threads=posix --disable-libssp --disable-libstdcxx-pch
--disable-werror
// Thread model: posix
// Supported LTO compression algorithms: zlib zstd
// gcc version 13.2.1 20230801 (GCC) 
// 
// test2.cpp:25:38: internal compiler error: in unify, at cp/pt.cc:24606
//    25 | using R = normalize_similar2<px<int>>::type;
//       |                                      ^~
// 0x1ad33c8 internal_error(char const*, ...)
//      ???:0
// 0x6b7b63 fancy_abort(char const*, int, char const*)
//      ???:0
// 0x8729fd most_specialized_partial_spec(tree_node*, int)
//      ???:0
// 0x875849 instantiate_class_template(tree_node*)
//      ???:0
// 0x8be335 complete_type(tree_node*)
//      ???:0
// 0x9443d0 c_common_parse_file()
//      ???:0
// Please submit a full bug report, with preprocessed source.
// Please include the complete backtrace with any bug report.
// See <https://bugs.archlinux.org/> for instructions.

// /usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1plus -quiet -D_GNU_SOURCE
test2.cpp -quiet -dumpdir a- -dumpbase test2.cpp -dumpbase-ext .cpp
-mtune=generic -march=x86-64 -fsyntax-only -freport-bug -o - -frandom-seed=0
-fdump-noaddr

# 0 "test2.cpp"
# 0 "<built-in>"
# 0 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 0 "<command-line>" 2
# 1 "test2.cpp"
  template<template<class T, T...> class Tpl>
  struct tpl_type2;

  template<template<class, unsigned...> class Tpl>
  struct tpl_type3;

  template<class T>
  struct normalize_similar2
  {};

  template<class T, template<class, T...> class Tpl, T... xs>
  struct normalize_similar2<Tpl<T, xs...>>
  {
    using type = tpl_type2<Tpl>;
  };

  template<template<class, unsigned...> class Tpl, class T, unsigned... N>
  struct normalize_similar2<Tpl<T, N...>>
  {
    using type = tpl_type3<Tpl>;
  };

template<class T, T...> struct px;

using R = normalize_similar2<px<int>>::type;

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

* [Bug c++/113584] ICE in unify, at cp/pt.cc:24640 with template specialization on 2 matching template template parameter
  2024-01-24 15:18 [Bug c++/113584] New: ICE in unify, at cp/pt.cc:24640 with template specialization on 2 matching template template parameter jonathan.poelen at gmail dot com
@ 2024-01-24 16:15 ` mpolacek at gcc dot gnu.org
  2024-01-24 16:24 ` mpolacek at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2024-01-24 16:15 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
There has got to be a dup; I'm certain I've seen this ICE many times.

$ ./cc1plus -quiet 113584.C
113584.C:25:38: internal compiler error: in unify, at cp/pt.cc:24640
   25 | using R = normalize_similar2<px<int>>::type;
      |                                      ^~
0x111966a unify
        /home/mpolacek/src/gcc/gcc/cp/pt.cc:24640
0x111a6ec unify
        /home/mpolacek/src/gcc/gcc/cp/pt.cc:24836
0x1113a09 unify_one_argument
        /home/mpolacek/src/gcc/gcc/cp/pt.cc:23166
0x11175ec unify_pack_expansion
        /home/mpolacek/src/gcc/gcc/cp/pt.cc:24217
0x111b244 unify
        /home/mpolacek/src/gcc/gcc/cp/pt.cc:25015
0x10c20ab unify_bound_ttp_args
        /home/mpolacek/src/gcc/gcc/cp/pt.cc:8072
0x1119a32 unify
        /home/mpolacek/src/gcc/gcc/cp/pt.cc:24668
0x111b1d9 unify
        /home/mpolacek/src/gcc/gcc/cp/pt.cc:25009
0x112020c get_partial_spec_bindings
        /home/mpolacek/src/gcc/gcc/cp/pt.cc:25893
0x111f79a more_specialized_partial_spec
        /home/mpolacek/src/gcc/gcc/cp/pt.cc:25767

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

* [Bug c++/113584] ICE in unify, at cp/pt.cc:24640 with template specialization on 2 matching template template parameter
  2024-01-24 15:18 [Bug c++/113584] New: ICE in unify, at cp/pt.cc:24640 with template specialization on 2 matching template template parameter jonathan.poelen at gmail dot com
  2024-01-24 16:15 ` [Bug c++/113584] " mpolacek at gcc dot gnu.org
@ 2024-01-24 16:24 ` mpolacek at gcc dot gnu.org
  2024-01-24 16:27 ` [Bug c++/113584] [11/12/13/14 Regression] " mpolacek at gcc dot gnu.org
  2024-01-24 16:28 ` mpolacek at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2024-01-24 16:24 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2024-01-24
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Started with r8-1437-g3da557ec145823:

commit 3da557ec145823c3f51ff3fa7c619d0064134800
Author:     Jason Merrill <jason@redhat.com>
AuthorDate: Fri Jun 16 22:27:59 2017 -0400

    PR c++/81102 - Wrong error with partial specialization.

            * pt.c (unify) [TEMPLATE_PARM_INDEX]: Strip reference when
comparing
            types.  Do type deduction later.

    From-SVN: r249320

Before:

113584.C:25:38: error: ambiguous template instantiation for ‘struct
normalize_similar2<px<int> >’
 using R = normalize_similar2<px<int>>::type;
                                      ^~
113584.C:12:10: note: candidates are: ‘template<class T, template<class, T
...<anonymous> > class Tpl, T ...xs> struct normalize_similar2<Tpl<T, xs ...> >
[with T = int; Tpl = px; T ...xs = {}]’
   struct normalize_similar2<Tpl<T, xs...>>
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
113584.C:18:10: note:                 ‘template<template<class, unsigned int
...<anonymous> > class Tpl, class T, unsigned int ...N> struct
normalize_similar2<Tpl<T, N ...> > [with Tpl = px; T = int; unsigned int ...N =
{}]’
   struct normalize_similar2<Tpl<T, N...>>
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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

* [Bug c++/113584] [11/12/13/14 Regression] ICE in unify, at cp/pt.cc:24640 with template specialization on 2 matching template template parameter
  2024-01-24 15:18 [Bug c++/113584] New: ICE in unify, at cp/pt.cc:24640 with template specialization on 2 matching template template parameter jonathan.poelen at gmail dot com
  2024-01-24 16:15 ` [Bug c++/113584] " mpolacek at gcc dot gnu.org
  2024-01-24 16:24 ` mpolacek at gcc dot gnu.org
@ 2024-01-24 16:27 ` mpolacek at gcc dot gnu.org
  2024-01-24 16:28 ` mpolacek at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2024-01-24 16:27 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|ICE in unify, at            |[11/12/13/14 Regression]
                   |cp/pt.cc:24640 with         |ICE in unify, at
                   |template specialization on  |cp/pt.cc:24640 with
                   |2 matching template         |template specialization on
                   |template parameter          |2 matching template
                   |                            |template parameter
           Keywords|                            |ice-on-invalid-code
   Target Milestone|---                         |11.5

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

* [Bug c++/113584] [11/12/13/14 Regression] ICE in unify, at cp/pt.cc:24640 with template specialization on 2 matching template template parameter
  2024-01-24 15:18 [Bug c++/113584] New: ICE in unify, at cp/pt.cc:24640 with template specialization on 2 matching template template parameter jonathan.poelen at gmail dot com
                   ` (2 preceding siblings ...)
  2024-01-24 16:27 ` [Bug c++/113584] [11/12/13/14 Regression] " mpolacek at gcc dot gnu.org
@ 2024-01-24 16:28 ` mpolacek at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2024-01-24 16:28 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|ice-on-invalid-code         |ice-on-valid-code
           Priority|P3                          |P2

--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Oop, clang++ compiles it, so probably an ICE-on-valid.

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

end of thread, other threads:[~2024-01-24 16:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-24 15:18 [Bug c++/113584] New: ICE in unify, at cp/pt.cc:24640 with template specialization on 2 matching template template parameter jonathan.poelen at gmail dot com
2024-01-24 16:15 ` [Bug c++/113584] " mpolacek at gcc dot gnu.org
2024-01-24 16:24 ` mpolacek at gcc dot gnu.org
2024-01-24 16:27 ` [Bug c++/113584] [11/12/13/14 Regression] " mpolacek at gcc dot gnu.org
2024-01-24 16:28 ` mpolacek 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).