public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jsm28 at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/107148] [10/11/12/13 Regression] ICE in bot_manip, at cp/tree.cc:3252
Date: Wed, 16 Nov 2022 22:00:59 +0000	[thread overview]
Message-ID: <bug-107148-4-FQzobxq6zC@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-107148-4@http.gcc.gnu.org/bugzilla/>

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

Joseph S. Myers <jsm28 at gcc dot gnu.org> changed:

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

--- Comment #2 from Joseph S. Myers <jsm28 at gcc dot gnu.org> ---
The following test produces the same ICE without any prior errors. I'm not sure
if a statement expression should be considered valid in this context, or if
that indicates that an earlier error is needed. Compile this test with
-fimplicit-constexpr (thus, needs GCC 12 or later, so this test does not show a
regression, unlike the ICE-on-invalid regression in the original bug report).

int f(int);
class A {
public:
  A(int);
};
class C {
  C() : m(f(({ int x = 1; x; }))) {}
  A m;
};

Alternatively, not needing -fimplicit-constexpr (rejected by GCC 10 and before;
GCC 11 and later ICE; so again not showing a regression):

int f(int);
class A {
public:
  A(int);
};
class C {
  constexpr C() : m(f(({ int x = 1; x; }))) {}
  A m;
};

The failing assertion is

          gcc_assert (VAR_P (*p) && DECL_ARTIFICIAL (*p) && !TREE_STATIC (*p));

where *p is the variable x in the statement expression, so fails
DECL_ARTIFICIAL. If this test is valid, I don't know if it should reach the
code with this assertion (or what additional issues might arise if the variable
in the statement expression were declared static).

  parent reply	other threads:[~2022-11-16 22:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-04  6:26 [Bug c++/107148] New: " asolokha at gmx dot com
2022-10-04  8:44 ` [Bug c++/107148] " marxin at gcc dot gnu.org
2022-10-04 14:01 ` mpolacek at gcc dot gnu.org
2022-10-06 10:08 ` rguenth at gcc dot gnu.org
2022-11-16 22:00 ` jsm28 at gcc dot gnu.org [this message]
2023-07-07 10:44 ` [Bug c++/107148] [11/12/13/14 Regression] ICE in bot_manip with statement expressions, " rguenth 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-107148-4-FQzobxq6zC@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).