public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "avi@cloudius-systems.com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/103319] New: [coroutines] ICE in is_this_parameter, at cp/semantics.c:10672
Date: Thu, 18 Nov 2021 16:28:51 +0000	[thread overview]
Message-ID: <bug-103319-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 103319
           Summary: [coroutines] ICE in is_this_parameter, at
                    cp/semantics.c:10672
           Product: gcc
           Version: 11.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: avi@cloudius-systems.com
  Target Milestone: ---

Possibly related: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102489

A very large test case gives me this:

distcc[3605276] ERROR: compile /home/avi/scylla/db/commitlog/commitlog.cc on
localhost failed
/home/avi/scylla/db/commitlog/commitlog.cc: In function ‘void
db::commitlog::segment::cycle(bool,
bool)::<lambda()>::operator()(db::commitlog::segment::cycle(bool,
bool)::<lambda()>::_ZZN2db9commitlog7segment5cycleEbbENKUlvE_clEv.frame*)’:
/home/avi/scylla/db/commitlog/commitlog.cc:901:9: internal compiler error: in
is_this_parameter, at cp/semantics.c:10672
  901 |         }, [&]() -> future<> {


It is accepted by clang.

gcc 12 accepts the code, and gcc 11 with this patch backported:

commit daa9c6b015a33fa98af0ee7cd6919120248ab5f9 (tag: is_this_parameter)
Author: Jason Merrill <jason@redhat.com>
Date:   Sat Nov 13 17:16:46 2021 -0500

    c++: is_this_parameter and coroutines proxies

    Compiling coroutines/pr95736.C with the implicit constexpr patch broke
    because is_this_parameter didn't recognize the coroutines proxy for 'this'.

    gcc/cp/ChangeLog:

            * semantics.c (is_this_parameter): Check DECL_HAS_VALUE_EXPR_P
            instead of is_capture_proxy.

diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 60e0982cc48..15404426bce 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -11380,11 +11380,12 @@ float_const_decimal64_p (void)
 bool
 is_this_parameter (tree t)
 {
   if (!DECL_P (t) || DECL_NAME (t) != this_identifier)
     return false;
-  gcc_assert (TREE_CODE (t) == PARM_DECL || is_capture_proxy (t)
+  gcc_assert (TREE_CODE (t) == PARM_DECL
+             || (TREE_CODE (t) == VAR_DECL && DECL_HAS_VALUE_EXPR_P (t))
              || (cp_binding_oracle && TREE_CODE (t) == VAR_DECL));
   return true;
 }

 /* Insert the deduced return type for an auto function.  */



Also works. Requesting this backport for gcc 11 (I don't know if this is a
regression or not since I'm attempting to migrate from clang).

I don't have a reduced test case. I can try to reduce it, but perhaps knowledge
of the fix will make coming up with a small test case simple.

             reply	other threads:[~2021-11-18 16:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-18 16:28 avi@cloudius-systems.com [this message]
2021-11-18 16:41 ` [Bug c++/103319] " iains at gcc dot gnu.org
2021-11-29 11:09 ` avi at scylladb dot com
2021-12-01 18:26 ` jason at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-103319-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).