public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/94808] New: [ICE] [Regression] Segfault during diagnostics from concept check failure
@ 2020-04-27 20:33 eric.niebler at gmail dot com
  2020-04-28 12:12 ` [Bug c++/94808] " ppalka at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: eric.niebler at gmail dot com @ 2020-04-27 20:33 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 94808
           Summary: [ICE] [Regression] Segfault during diagnostics from
                    concept check failure
           Product: gcc
           Version: 10.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 48385
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48385&action=edit
Unreduced, preprocessed source

This problem reproduces on trunk built today (4/27/2020). Compile the attached
preprocessed source with the attached script (flags: -std=gnu++2a).

I expect to see a diagnostic since the program should not satisfy the concept
checks. Instead, during diagnostic reporting I see the following:

/Users/eniebler/Dropbox
(Facebook)/home/Code/Code/libunifex/test/P0443_test.cpp: In member function
‘virtual void P0443_connect_with_executor_Test::TestBody()’:
/Users/eniebler/Dropbox
(Facebook)/home/Code/Code/libunifex/test/P0443_test.cpp:81:53: error: no match
for call to ‘(const unifex::_connect::_fn) ({anonymous}::inline_executor,
P0443_connect_with_executor_Test::TestBody()::_receiver)’
   81 |   auto op = connect(inline_executor{}, _receiver{&i});
      |                                                     ^
In file included from /Users/eniebler/Dropbox
(Facebook)/home/Code/Code/libunifex/source/../include/unifex/executor_concepts.hpp:174,
                 from /Users/eniebler/Dropbox
(Facebook)/home/Code/Code/libunifex/test/P0443_test.cpp:17:
/Users/eniebler/Dropbox
(Facebook)/home/Code/Code/libunifex/source/../include/unifex/sender_concepts.hpp:224:10:
note: candidate: ‘template<class Sender, class Receiver>  requires
(receiver<Receiver, std::__exception_ptr::exception_ptr>) && ((sender<Sender>)
&& (tag_invocable<unifex::_connect::_fn, Sender, Receiver>))
unifex::_tag_invoke::tag_invoke_result_t<unifex::_connect::_fn, Sender,
Receiver> unifex::_connect::_fn::operator()(Sender&&, Receiver&&) const’
  224 |     auto operator()(Sender&& s, Receiver&& r) const
      |          ^~~~~~~~
/Users/eniebler/Dropbox
(Facebook)/home/Code/Code/libunifex/source/../include/unifex/sender_concepts.hpp:224:10:
note:   template argument deduction/substitution failed:
In file included from /Users/eniebler/Dropbox
(Facebook)/home/Code/Code/libunifex/source/../include/unifex/executor_concepts.hpp:20,
                 from /Users/eniebler/Dropbox
(Facebook)/home/Code/Code/libunifex/test/P0443_test.cpp:17:
/Users/eniebler/Dropbox
(Facebook)/home/Code/Code/libunifex/source/../include/unifex/tag_invoke.hpp: In
substitution of ‘template<class CPO, class ... Args> using tag_invoke_result_t
= decltype (unifex::_tag_invoke::tag_invoke(static_cast<CPO&& (*)()
noexcept>(nullptr)(), static_cast<Args&& (*)()noexcept (true)>(nullptr)()...))
[with CPO = unifex::_connect::_fn; Args = {{anonymous}::inline_executor,
P0443_connect_with_executor_Test::TestBody()::_receiver}]’:
/Users/eniebler/Dropbox
(Facebook)/home/Code/Code/libunifex/source/../include/unifex/sender_concepts.hpp:224:10:
  required by substitution of ‘template<class Sender, class Receiver>  requires
(receiver<Receiver, std::__exception_ptr::exception_ptr>) && ((sender<Sender>)
&& (tag_invocable<unifex::_connect::_fn, Sender, Receiver>))
unifex::_tag_invoke::tag_invoke_result_t<unifex::_connect::_fn, Sender,
Receiver> unifex::_connect::_fn::operator()(Sender&&, Receiver&&) const [with
Sender = {anonymous}::inline_executor; Receiver =
P0443_connect_with_executor_Test::TestBody()::_receiver]’
/Users/eniebler/Dropbox
(Facebook)/home/Code/Code/libunifex/test/P0443_test.cpp:81:53:   required from
here
/Users/eniebler/Dropbox
(Facebook)/home/Code/Code/libunifex/source/../include/unifex/tag_invoke.hpp:39:19:
error: too many arguments to function ‘void unifex::_tag_invoke::tag_invoke()’
   39 |         tag_invoke(UNIFEX_DECLVAL(CPO && ), UNIFEX_DECLVAL(Args &&
)...));
      |        
~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~              
/Users/eniebler/Dropbox
(Facebook)/home/Code/Code/libunifex/source/../include/unifex/tag_invoke.hpp:26:10:
note: declared here
   26 |     void tag_invoke();
      |          ^~~~~~~~~~
In file included from /Users/eniebler/Dropbox
(Facebook)/home/Code/Code/libunifex/source/../include/unifex/executor_concepts.hpp:174,
                 from /Users/eniebler/Dropbox
(Facebook)/home/Code/Code/libunifex/test/P0443_test.cpp:17:
/Users/eniebler/Dropbox
(Facebook)/home/Code/Code/libunifex/source/../include/unifex/sender_concepts.hpp:233:10:
note: candidate: ‘template<class Sender, class Receiver>  requires
(receiver<Receiver, std::__exception_ptr::exception_ptr>) && !((sender<Sender>)
&& (tag_invocable<unifex::_connect::_fn, Sender, Receiver>)) &&
((sender<Sender>) && (_has_member_connect<Sender, Receiver>))
unifex::_connect::_member_connect_result_t<Sender, Receiver>
unifex::_connect::_fn::operator()(Sender&&, Receiver&&) const’
  233 |     auto operator()(Sender&& s, Receiver&& r) const
      |          ^~~~~~~~
/Users/eniebler/Dropbox
(Facebook)/home/Code/Code/libunifex/source/../include/unifex/sender_concepts.hpp:233:10:
note:   template argument deduction/substitution failed:
/Users/eniebler/Dropbox
(Facebook)/home/Code/Code/libunifex/source/../include/unifex/sender_concepts.hpp:
In substitution of ‘template<class Sender, class Receiver> using
_member_connect_result_t = decltype (static_cast<Sender&& (*)()
noexcept>(nullptr)().connect(static_cast<Receiver&& (*)()
noexcept>(nullptr)())) [with Sender = {anonymous}::inline_executor; Receiver =
P0443_connect_with_executor_Test::TestBody()::_receiver]’:
/Users/eniebler/Dropbox
(Facebook)/home/Code/Code/libunifex/source/../include/unifex/sender_concepts.hpp:233:10:
  required by substitution of ‘template<class Sender, class Receiver>  requires
(receiver<Receiver, std::__exception_ptr::exception_ptr>) && !((sender<Sender>)
&& (tag_invocable<unifex::_connect::_fn, Sender, Receiver>)) &&
((sender<Sender>) && (_has_member_connect<Sender, Receiver>))
unifex::_connect::_member_connect_result_t<Sender, Receiver>
unifex::_connect::_fn::operator()(Sender&&, Receiver&&) const [with Sender =
{anonymous}::inline_executor; Receiver =
P0443_connect_with_executor_Test::TestBody()::_receiver]’
/Users/eniebler/Dropbox
(Facebook)/home/Code/Code/libunifex/test/P0443_test.cpp:81:53:   required from
here
/Users/eniebler/Dropbox
(Facebook)/home/Code/Code/libunifex/source/../include/unifex/sender_concepts.hpp:189:64:
error: ‘struct {anonymous}::inline_executor’ has no member named ‘connect’
  189 |       decltype((UNIFEX_DECLVAL(Sender&&)).connect(
      |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~             ^      
In file included from /Users/eniebler/Dropbox
(Facebook)/home/Code/Code/libunifex/source/../include/unifex/executor_concepts.hpp:174,
                 from /Users/eniebler/Dropbox
(Facebook)/home/Code/Code/libunifex/test/P0443_test.cpp:17:
/Users/eniebler/Dropbox
(Facebook)/home/Code/Code/libunifex/source/../include/unifex/sender_concepts.hpp:243:10:
note: candidate: ‘unifex::_connect::_fn::_as_operation<Executor, Receiver>
unifex::_connect::_fn::operator()(Executor&&, Receiver&&) const [with Executor
= {anonymous}::inline_executor; Receiver =
P0443_connect_with_executor_Test::TestBody()::_receiver;
unifex::_connect::_fn::_as_operation<Executor, Receiver> =
unifex::_connect::_fn::_as_op<{anonymous}::inline_executor,
P0443_connect_with_executor_Test::TestBody()::_receiver>::type]’
  243 |     auto operator()(Executor&& e, Receiver&& r) const
      |          ^~~~~~~~
/Users/eniebler/Dropbox
(Facebook)/home/Code/Code/libunifex/source/../include/unifex/sender_concepts.hpp:243:10:
note: constraints not satisfied
‘
In file included from /Users/eniebler/Dropbox
(Facebook)/home/Code/Code/libunifex/source/../include/unifex/sender_concepts.hpp:22,
                 from /Users/eniebler/Dropbox
(Facebook)/home/Code/Code/libunifex/source/../include/unifex/executor_concepts.hpp:174,
                 from /Users/eniebler/Dropbox
(Facebook)/home/Code/Code/libunifex/test/P0443_test.cpp:17:
/Users/eniebler/Dropbox
(Facebook)/home/Code/Code/libunifex/source/../include/unifex/receiver_concepts.hpp:
In instantiation of ‘unifex::_connect::_fn::_as_operation<Executor, Receiver>
unifex::_connect::_fn::operator()(Executor&&, Receiver&&) const [with Executor
= {anonymous}::inline_executor; Receiver =
P0443_connect_with_executor_Test::TestBody()::_receiver;
unifex::_connect::_fn::_as_operation<Executor, Receiver> =
unifex::_connect::_fn::_as_op<{anonymous}::inline_executor,
P0443_connect_with_executor_Test::TestBody()::_receiver>::type]’:
/Users/eniebler/Dropbox
(Facebook)/home/Code/Code/libunifex/test/P0443_test.cpp:81:53:   required from
here
/Users/eniebler/Dropbox
(Facebook)/home/Code/Code/libunifex/source/../include/unifex/receiver_concepts.hpp:218:9:
  required for the satisfaction of ‘_receiver_of<R, An ...>’ [with R =
P0443_connect_with_executor_Test::TestBody::_receiver; An = {}]
/Users/eniebler/Dropbox
(Facebook)/home/Code/Code/libunifex/source/../include/unifex/receiver_concepts.hpp:227:3:
  required for the satisfaction of ‘receiver_of<Receiver>’ [with Receiver =
P0443_connect_with_executor_Test::TestBody::_receiver]
/Users/eniebler/Dropbox
(Facebook)/home/Code/Code/libunifex/source/../include/unifex/receiver_concepts.hpp:218:24:
  in requirements with
‘unifex::remove_cvref_t<P0443_connect_with_executor_Test::TestBody()::_receiver>&&
t’, Segmentation fault: 11
  218 | UNIFEX_CONCEPT_FRAGMENT(
      |                                                                        
      ^                           
libbacktrace could not find executable to open
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://gcc.gnu.org/bugs/> for instructions.

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

* [Bug c++/94808] [ICE] [Regression] Segfault during diagnostics from concept check failure
  2020-04-27 20:33 [Bug c++/94808] New: [ICE] [Regression] Segfault during diagnostics from concept check failure eric.niebler at gmail dot com
@ 2020-04-28 12:12 ` ppalka at gcc dot gnu.org
  2020-04-29  2:08 ` cvs-commit at gcc dot gnu.org
  2020-04-29  2:10 ` ppalka at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: ppalka at gcc dot gnu.org @ 2020-04-28 12:12 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2020-04-28
             Status|UNCONFIRMED                 |ASSIGNED
     Ever confirmed|0                           |1
           Assignee|unassigned at gcc dot gnu.org      |ppalka at gcc dot gnu.org
                 CC|                            |ppalka at gcc dot gnu.org

--- Comment #1 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Confirmed.  Reduced testcase:

template<typename T, typename... Args>
  concept baz = requires (T t, Args... args) { *t; };

template<typename T>
  requires baz<T>
void foo() { }

void bar()
{
  foo<int>();
}


GCC 10 segfaults during diagnostics, GCC 9 doesn't.

Looking into it.

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

* [Bug c++/94808] [ICE] [Regression] Segfault during diagnostics from concept check failure
  2020-04-27 20:33 [Bug c++/94808] New: [ICE] [Regression] Segfault during diagnostics from concept check failure eric.niebler at gmail dot com
  2020-04-28 12:12 ` [Bug c++/94808] " ppalka at gcc dot gnu.org
@ 2020-04-29  2:08 ` cvs-commit at gcc dot gnu.org
  2020-04-29  2:10 ` ppalka at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-04-29  2:08 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>:

https://gcc.gnu.org/g:43439d5e8424f3a746003ef8953e1cdc120fbbd7

commit r10-8024-g43439d5e8424f3a746003ef8953e1cdc120fbbd7
Author: Patrick Palka <ppalka@redhat.com>
Date:   Tue Apr 28 21:45:54 2020 -0400

    c++: Parameter pack in requires parameter list [PR94808]

    When printing the substituted parameter list of a requires-expression as
    part of the "in requirements with ..." context line during concepts
    diagnostics, we weren't considering that substitution into a parameter
    pack can yield zero or multiple parameters.

    This patch changes the way we print the parameter list of a
    requires-expression in print_requires_expression_info.  We now print the
    dependent form of the parameter list (along with its template parameter
    mapping) instead of printing its substituted form.  Besides being an
    improvement in its own, this also sidesteps the substitution issue in the
    PR altogether.

    gcc/cp/ChangeLog:

            PR c++/94808
            * error.c (print_requires_expression_info): Print the dependent
            form of the parameter list with its template parameter mapping,
            rather than printing the substituted form.

    gcc/testsuite/ChangeLog:

            PR c++/94808
            * g++.dg/concepts/diagnostic12.C: New test.
            * g++.dg/concepts/diagnostic5.C: Adjust dg-message.

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

* [Bug c++/94808] [ICE] [Regression] Segfault during diagnostics from concept check failure
  2020-04-27 20:33 [Bug c++/94808] New: [ICE] [Regression] Segfault during diagnostics from concept check failure eric.niebler at gmail dot com
  2020-04-28 12:12 ` [Bug c++/94808] " ppalka at gcc dot gnu.org
  2020-04-29  2:08 ` cvs-commit at gcc dot gnu.org
@ 2020-04-29  2:10 ` ppalka at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: ppalka at gcc dot gnu.org @ 2020-04-29  2:10 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
   Target Milestone|---                         |10.0
         Resolution|---                         |FIXED

--- Comment #3 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed.

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

end of thread, other threads:[~2020-04-29  2:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-27 20:33 [Bug c++/94808] New: [ICE] [Regression] Segfault during diagnostics from concept check failure eric.niebler at gmail dot com
2020-04-28 12:12 ` [Bug c++/94808] " ppalka at gcc dot gnu.org
2020-04-29  2:08 ` cvs-commit at gcc dot gnu.org
2020-04-29  2:10 ` ppalka 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).