public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/109754] New: [ICE] internal compiler error: in coerce_template_parms, at cp/pt.cc:9183
@ 2023-05-05 21:55 eric.niebler at gmail dot com
  2023-05-05 22:06 ` [Bug c++/109754] " mpolacek at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: eric.niebler at gmail dot com @ 2023-05-05 21:55 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 109754
           Summary: [ICE] internal compiler error: in
                    coerce_template_parms, at cp/pt.cc:9183
           Product: gcc
           Version: 12.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: eric.niebler at gmail dot com
  Target Milestone: ---

Created attachment 55012
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55012&action=edit
result of -freport-bug including preprocessed source

similar to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105475, but not using
coroutines

Repro: compile attached code with -std=c++20  

Result:

In file included from test.cpp:1:
stdexec/include/stdexec/__detail/__meta.hpp: In substitution of ‘template<class
_Fn, class ... _Args> using __minvoke = stdexec::__meval<_Fn::template __f,
_Args ...> [with _Fn =
stdexec::__mexpand<stdexec::__tuple<stdexec::__tup::__gen_tuple_fun_fn::operator()<int,
stdexec::__tup::__coerce<immovable>, const char*>(int&&,
stdexec::__tup::__coerce<immovable>&&, const char*&&)
const::<lambda()>::<lambda(_Self&&, _Fun&&)> > >; _Args = {stdexec::__msize}]’:
stdexec/include/stdexec/__detail/__meta.hpp:431:9:   required by substitution
of ‘template<class _Fn, class _List> using __mapply =
stdexec::__minvoke<stdexec::__mexpand<_List>, _Fn> [with _Fn =
stdexec::__msize; _List =
stdexec::__tuple<stdexec::__tup::__gen_tuple_fun_fn::operator()<int,
stdexec::__tup::__coerce<immovable>, const char*>(int&&,
stdexec::__tup::__coerce<immovable>&&, const char*&&)
const::<lambda()>::<lambda(_Self&&, _Fun&&)> >]’
stdexec/include/stdexec/__detail/__tuple.hpp:491:47:   required from ‘const
std::size_t
stdexec::tuple_size_v<stdexec::__tuple<stdexec::__tup::__gen_tuple_fun_fn::operator()<int,
stdexec::__tup::__coerce<immovable>, const char*>(int&&,
stdexec::__tup::__coerce<immovable>&&, const char*&&)
const::<lambda()>::<lambda(_Self&&, _Fun&&)> > >’
test.cpp:22:26:   required from here
stdexec/include/stdexec/__detail/__meta.hpp:233:9: internal compiler error: in
coerce_template_parms, at cp/pt.cc:9183
  233 |   using __minvoke = __meval<_Fn::template __f, _Args...>;
      |         ^~~~~~~~~
0x6623b1 coerce_template_parms
        ../../src/gcc/cp/pt.cc:9183
0x818feb instantiate_alias_template
        ../../src/gcc/cp/pt.cc:21719
0x818feb tsubst(tree_node*, tree_node*, int, tree_node*)
        ../../src/gcc/cp/pt.cc:15607
0x81c344 tsubst_decl
        ../../src/gcc/cp/pt.cc:14952
0x81815a instantiate_template_1
        ../../src/gcc/cp/pt.cc:21643
0x81908e instantiate_template(tree_node*, tree_node*, int)
        ../../src/gcc/cp/pt.cc:21702
0x81908e instantiate_alias_template
        ../../src/gcc/cp/pt.cc:21740
0x81908e tsubst(tree_node*, tree_node*, int, tree_node*)
        ../../src/gcc/cp/pt.cc:15607
0x81c344 tsubst_decl
        ../../src/gcc/cp/pt.cc:14952
0x81815a instantiate_template_1
        ../../src/gcc/cp/pt.cc:21643
0x81908e instantiate_template(tree_node*, tree_node*, int)
        ../../src/gcc/cp/pt.cc:21702
0x81908e instantiate_alias_template
        ../../src/gcc/cp/pt.cc:21740
0x81908e tsubst(tree_node*, tree_node*, int, tree_node*)
        ../../src/gcc/cp/pt.cc:15607
0x825bad tsubst_template_args(tree_node*, tree_node*, int, tree_node*)
        ../../src/gcc/cp/pt.cc:13517
0x8108fe tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        ../../src/gcc/cp/pt.cc:20055
0x8200e8 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../../src/gcc/cp/pt.cc:19491
0x81fe84 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../../src/gcc/cp/pt.cc:18462
0x81fe84 instantiate_decl(tree_node*, bool, bool)
        ../../src/gcc/cp/pt.cc:26653
0x7313c1 maybe_instantiate_decl(tree_node*)
        ../../src/gcc/cp/decl2.cc:5627
0x7375ef maybe_instantiate_decl(tree_node*)
        ../../src/gcc/cp/decl2.cc:5614
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <file:///usr/share/doc/gcc-12/README.Bugs> for instructions.

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

* [Bug c++/109754] [ICE] internal compiler error: in coerce_template_parms, at cp/pt.cc:9183
  2023-05-05 21:55 [Bug c++/109754] New: [ICE] internal compiler error: in coerce_template_parms, at cp/pt.cc:9183 eric.niebler at gmail dot com
@ 2023-05-05 22:06 ` mpolacek at gcc dot gnu.org
  2023-05-05 22:43 ` pinskia at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2023-05-05 22:06 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Confirmed.

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

* [Bug c++/109754] [ICE] internal compiler error: in coerce_template_parms, at cp/pt.cc:9183
  2023-05-05 21:55 [Bug c++/109754] New: [ICE] internal compiler error: in coerce_template_parms, at cp/pt.cc:9183 eric.niebler at gmail dot com
  2023-05-05 22:06 ` [Bug c++/109754] " mpolacek at gcc dot gnu.org
@ 2023-05-05 22:43 ` pinskia at gcc dot gnu.org
  2023-05-05 22:46 ` mpolacek at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-05-05 22:43 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Reducing ...

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

* [Bug c++/109754] [ICE] internal compiler error: in coerce_template_parms, at cp/pt.cc:9183
  2023-05-05 21:55 [Bug c++/109754] New: [ICE] internal compiler error: in coerce_template_parms, at cp/pt.cc:9183 eric.niebler at gmail dot com
  2023-05-05 22:06 ` [Bug c++/109754] " mpolacek at gcc dot gnu.org
  2023-05-05 22:43 ` pinskia at gcc dot gnu.org
@ 2023-05-05 22:46 ` mpolacek at gcc dot gnu.org
  2023-05-05 23:47 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2023-05-05 22:46 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
cvise reduced it to

void declval();
template <typename, typename>
concept __same_as = requires { declval; };
template <class _Tp> _Tp __declval;
template <class> int __v;
using __msuccess = int;
template <int> struct __i;
template <class _Arg>
concept __ok = __same_as<_Arg, __msuccess>;
template <class... _Args>
concept _Ok = (__ok<_Args> && ...);
template <template <class> class> using __meval = __i<_Ok<>>;
template <class _Fn> using __minvoke = __meval<_Fn::template __f>;
template <class> struct __mexpand;
template <class, class _List> using __mapply = __minvoke<__mexpand<_List>>;
struct __msize;
template <class...> using __call_result_t = decltype(0);
template <class _Fun, class>
using __tuple_types_fn = decltype(__declval<_Fun>, [] {});
template <class _Fun> struct __mexpand {
  template <class _MetaFn> using __f = __tuple_types_fn<_Fun, _MetaFn>;
};
template <class _Tuple> long tuple_size_v = __v<__mapply<__msize, _Tuple>>;
template <class...> using tuple = __call_result_t<>;
using T = tuple<>;
                 static_assert(tuple_size_v< T >, "");


but that is probably invalid.

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

* [Bug c++/109754] [ICE] internal compiler error: in coerce_template_parms, at cp/pt.cc:9183
  2023-05-05 21:55 [Bug c++/109754] New: [ICE] internal compiler error: in coerce_template_parms, at cp/pt.cc:9183 eric.niebler at gmail dot com
                   ` (2 preceding siblings ...)
  2023-05-05 22:46 ` mpolacek at gcc dot gnu.org
@ 2023-05-05 23:47 ` pinskia at gcc dot gnu.org
  2023-05-05 23:56 ` pinskia at gcc dot gnu.org
  2024-04-13  8:21 ` pinskia at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-05-05 23:47 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |c++-lambda

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I am getting a feeling this is another one of these lambda inside a decltype
issues.

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

* [Bug c++/109754] [ICE] internal compiler error: in coerce_template_parms, at cp/pt.cc:9183
  2023-05-05 21:55 [Bug c++/109754] New: [ICE] internal compiler error: in coerce_template_parms, at cp/pt.cc:9183 eric.niebler at gmail dot com
                   ` (3 preceding siblings ...)
  2023-05-05 23:47 ` pinskia at gcc dot gnu.org
@ 2023-05-05 23:56 ` pinskia at gcc dot gnu.org
  2024-04-13  8:21 ` pinskia at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-05-05 23:56 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Reduced further:
```
template <template <class> class> class __meval{};
template <class _Fun, class>
  using __tuple_types_fn = decltype(_Fun(), [] {});
template <class _Fun>
struct __mexpand {
  template <class _MetaFn> using __f = __tuple_types_fn<_Fun, _MetaFn>;
};
auto t = __meval<__mexpand<int>::template __f>();

```

Removing the lambda inside the decltype removes the ICE.

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

* [Bug c++/109754] [ICE] internal compiler error: in coerce_template_parms, at cp/pt.cc:9183
  2023-05-05 21:55 [Bug c++/109754] New: [ICE] internal compiler error: in coerce_template_parms, at cp/pt.cc:9183 eric.niebler at gmail dot com
                   ` (4 preceding siblings ...)
  2023-05-05 23:56 ` pinskia at gcc dot gnu.org
@ 2024-04-13  8:21 ` pinskia at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-04-13  8:21 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |14.0

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed on the trunk for GCC 14 by the recent lambda template patches.

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

end of thread, other threads:[~2024-04-13  8:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-05 21:55 [Bug c++/109754] New: [ICE] internal compiler error: in coerce_template_parms, at cp/pt.cc:9183 eric.niebler at gmail dot com
2023-05-05 22:06 ` [Bug c++/109754] " mpolacek at gcc dot gnu.org
2023-05-05 22:43 ` pinskia at gcc dot gnu.org
2023-05-05 22:46 ` mpolacek at gcc dot gnu.org
2023-05-05 23:47 ` pinskia at gcc dot gnu.org
2023-05-05 23:56 ` pinskia at gcc dot gnu.org
2024-04-13  8:21 ` 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).