public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/110552] New: ICE on valid code in maybe_instantiate_noexcept
@ 2023-07-04 18:07 eric.niebler at gmail dot com
  2023-07-04 18:49 ` [Bug c++/110552] " pinskia at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: eric.niebler at gmail dot com @ 2023-07-04 18:07 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 110552
           Summary: ICE on valid code in maybe_instantiate_noexcept
           Product: gcc
           Version: 14.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 55469
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55469&action=edit
self-contained source file

Compile the attached source with -std=c++20. Result:

/home/eniebler/hello_world.cpp: In substitution of ‘template<class
_EnvProvider>  requires  tag_invocable<stdexec::__env::get_env_t, const
_EnvProvider&> constexpr
stdexec::__tag_invoke::tag_invoke_result_t<stdexec::__env::get_env_t, const
_EnvProvider&> stdexec::__env::get_env_t::operator()(const _EnvProvider&) const
[with _EnvProvider = stdexec::__basic_sender<<lambda(_Data, _Children
...)>::<lambda(_Cvref, _Fun&&)> >]’:
/home/eniebler/hello_world.cpp:2221:16:   required from here
/home/eniebler/hello_world.cpp:1465:59: internal compiler error: in
maybe_instantiate_noexcept, at cp/pt.cc:26753
 1465 |       requires(_Tag __tag, _Args&&... __args) { tag_invoke((_Tag&&)
__tag, (_Args&&) __args...); };
      |                                                
~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0xace10a maybe_instantiate_noexcept(tree_node*, int)
        ../../gcc/cp/pt.cc:26753
0x96272f mark_used(tree_node*, int)
        ../../gcc/cp/decl2.cc:5720
0x864a35 build_over_call
        ../../gcc/cp/call.cc:10394
0x867e0b build_new_function_call(tree_node*, vec<tree_node*, va_gc,
vl_embed>**, int)
        ../../gcc/cp/call.cc:5038
0xb304ff finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool,
bool, int)
        ../../gcc/cp/semantics.cc:2924
0xacc4e5 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*)
        ../../gcc/cp/pt.cc:21338
0xabb964 tsubst_expr(tree_node*, tree_node*, int, tree_node*)
        ../../gcc/cp/pt.cc:19888
0x8c3193 tsubst_valid_expression_requirement
        ../../gcc/cp/constraint.cc:2002
0x8cc3c0 tsubst_simple_requirement
        ../../gcc/cp/constraint.cc:2036
0x8cc3c0 tsubst_requirement
        ../../gcc/cp/constraint.cc:2233
0x8cc3c0 tsubst_requires_expr
        ../../gcc/cp/constraint.cc:2363
0x8cc8aa tsubst_requires_expr(tree_node*, tree_node*, int, tree_node*)
        ../../gcc/cp/constraint.cc:2382
0xac96c7 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*)
        ../../gcc/cp/pt.cc:21749
0xabb964 tsubst_expr(tree_node*, tree_node*, int, tree_node*)
        ../../gcc/cp/pt.cc:19888
0x8cde63 satisfy_atom
        ../../gcc/cp/constraint.cc:3041
0x8cde63 satisfy_constraint_r
        ../../gcc/cp/constraint.cc:3106
0x8ce723 satisfy_normalized_constraints
        ../../gcc/cp/constraint.cc:3131
0x8caefd satisfy_declaration_constraints
        ../../gcc/cp/constraint.cc:3352
0x8caefd constraint_satisfaction_value
        ../../gcc/cp/constraint.cc:3373
0x8ce78f constraints_satisfied_p(tree_node*, tree_node*)
        ../../gcc/cp/constraint.cc:3410
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.


See https://godbolt.org/z/1511TYvch for a demo of the bug on compiler explorer.

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

* [Bug c++/110552] ICE on valid code in maybe_instantiate_noexcept
  2023-07-04 18:07 [Bug c++/110552] New: ICE on valid code in maybe_instantiate_noexcept eric.niebler at gmail dot com
@ 2023-07-04 18:49 ` pinskia at gcc dot gnu.org
  2023-07-04 21:13 ` pinskia at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-07-04 18:49 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
reducing ...

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

* [Bug c++/110552] ICE on valid code in maybe_instantiate_noexcept
  2023-07-04 18:07 [Bug c++/110552] New: ICE on valid code in maybe_instantiate_noexcept eric.niebler at gmail dot com
  2023-07-04 18:49 ` [Bug c++/110552] " pinskia at gcc dot gnu.org
@ 2023-07-04 21:13 ` pinskia at gcc dot gnu.org
  2023-07-04 21:28 ` pinskia at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-07-04 21:13 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Looks like it is a lambda inside a decltype is causing it.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107430
[Bug 107430] [meta-bug] lambda in decltype

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

* [Bug c++/110552] ICE on valid code in maybe_instantiate_noexcept
  2023-07-04 18:07 [Bug c++/110552] New: ICE on valid code in maybe_instantiate_noexcept eric.niebler at gmail dot com
  2023-07-04 18:49 ` [Bug c++/110552] " pinskia at gcc dot gnu.org
  2023-07-04 21:13 ` pinskia at gcc dot gnu.org
@ 2023-07-04 21:28 ` pinskia at gcc dot gnu.org
  2023-07-04 21:30 ` pinskia at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-07-04 21:28 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Created attachment 55470
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55470&action=edit
reduced but invalid code

This is the reduced testcase I got but it became invalid code; maybe the
original is invalid too. But clang's error message is:
<source>:31:25: error: member reference base type '__tag_t' (aka 'void') is not
a structure or union
   31 |       noexcept(__tag_t().get_env(__self))) {}
      |                ~~~~~~~~~^~~~~~~~
<source>:30:15: note: in instantiation of exception specification for
'tag_invoke<stdexec::__env::get_env_t, stdexec::__basic_sender<stdexec::(lambda
at <source>:33:25)>>' requested here
   30 |   friend auto tag_invoke(_Tag, const _Self &__self) noexcept(
      |               ^
<source>:6:14: note: in instantiation of function template specialization
'stdexec::tag_invoke<stdexec::__env::get_env_t,
stdexec::__basic_sender<stdexec::(lambda at <source>:33:25)>>' requested here
    6 |     decltype(tag_invoke(__declval<_Tag>(), __declval<_Args>()...));
      |              ^
<source>:13:10: note: in instantiation of template type alias
'tag_invoke_result_t' requested here
   13 |       -> tag_invoke_result_t<get_env_t, const _EnvProvider &> {}
      |          ^
<source>:19:36: note: while substituting deduced template arguments into
function template 'operator()' [with _EnvProvider =
stdexec::__basic_sender<stdexec::(lambda at <source>:33:25)>]
   19 |                                  { get_env(__ep) };
      |                                    ^
<source>:19:36: note: in instantiation of requirement here
   19 |                                  { get_env(__ep) };
      |                                    ^~~~~~~~~~~~~
<source>:18:32: note: while substituting template arguments into constraint
expression here
   18 | concept environment_provider = requires(_EnvProvider &__ep) {
      |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   19 |                                  { get_env(__ep) };
      |                                  ~~~~~~~~~~~~~~~~~~
   20 |                                };
      |                                ~
<source>:35:15: note: while checking the satisfaction of concept
'environment_provider<stdexec::__basic_sender<stdexec::(lambda at
<source>:33:25)>>' requested here
   35 | static_assert(stdexec::environment_provider<S>);
      |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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

* [Bug c++/110552] ICE on valid code in maybe_instantiate_noexcept
  2023-07-04 18:07 [Bug c++/110552] New: ICE on valid code in maybe_instantiate_noexcept eric.niebler at gmail dot com
                   ` (2 preceding siblings ...)
  2023-07-04 21:28 ` pinskia at gcc dot gnu.org
@ 2023-07-04 21:30 ` pinskia at gcc dot gnu.org
  2023-07-04 21:30 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-07-04 21:30 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Created attachment 55471
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55471&action=edit
changed slightly to produce valid code

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

* [Bug c++/110552] ICE on valid code in maybe_instantiate_noexcept
  2023-07-04 18:07 [Bug c++/110552] New: ICE on valid code in maybe_instantiate_noexcept eric.niebler at gmail dot com
                   ` (3 preceding siblings ...)
  2023-07-04 21:30 ` pinskia at gcc dot gnu.org
@ 2023-07-04 21:30 ` pinskia at gcc dot gnu.org
  2023-07-04 21:36 ` pinskia at gcc dot gnu.org
  2024-04-13  8:25 ` pinskia at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-07-04 21:30 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2023-07-04
           Keywords|                            |ice-on-invalid-code,
                   |                            |ice-on-valid-code
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.

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

* [Bug c++/110552] ICE on valid code in maybe_instantiate_noexcept
  2023-07-04 18:07 [Bug c++/110552] New: ICE on valid code in maybe_instantiate_noexcept eric.niebler at gmail dot com
                   ` (4 preceding siblings ...)
  2023-07-04 21:30 ` pinskia at gcc dot gnu.org
@ 2023-07-04 21:36 ` pinskia at gcc dot gnu.org
  2024-04-13  8:25 ` pinskia at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-07-04 21:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #2)
> Looks like it is a lambda inside a decltype is causing it.

The reason why I say that is if I change __apply_fn's operator() not to take a
second argument and remove the lambda from the call to it in __tag_from, then
this works.

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

* [Bug c++/110552] ICE on valid code in maybe_instantiate_noexcept
  2023-07-04 18:07 [Bug c++/110552] New: ICE on valid code in maybe_instantiate_noexcept eric.niebler at gmail dot com
                   ` (5 preceding siblings ...)
  2023-07-04 21:36 ` pinskia at gcc dot gnu.org
@ 2024-04-13  8:25 ` pinskia at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-04-13  8:25 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #7 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] 8+ messages in thread

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

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-04 18:07 [Bug c++/110552] New: ICE on valid code in maybe_instantiate_noexcept eric.niebler at gmail dot com
2023-07-04 18:49 ` [Bug c++/110552] " pinskia at gcc dot gnu.org
2023-07-04 21:13 ` pinskia at gcc dot gnu.org
2023-07-04 21:28 ` pinskia at gcc dot gnu.org
2023-07-04 21:30 ` pinskia at gcc dot gnu.org
2023-07-04 21:30 ` pinskia at gcc dot gnu.org
2023-07-04 21:36 ` pinskia at gcc dot gnu.org
2024-04-13  8: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).