public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/108702] [13 Regression] ICE in get_partitioning_class, at symtab.cc:2096 since r13-4161-g32d16fe9d7e347bc
Date: Wed, 08 Feb 2023 17:27:54 +0000	[thread overview]
Message-ID: <bug-108702-4-Xbm0Q9YrVG@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-108702-4@http.gcc.gnu.org/bugzilla/>

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|ipa                         |c++
           Priority|P3                          |P1
                 CC|                            |jason at gcc dot gnu.org
   Target Milestone|---                         |13.0

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Seems the reason why the above testcase works and stmtexpr19.C doesn't is in
make_rtl_for_nonlocal_decl's
7732      /* We defer emission of local statics until the corresponding
7733         DECL_EXPR is expanded.  But with constexpr its function might
never
7734         be expanded, so go ahead and tell cgraph about the variable now. 
*/
7735      defer_p = ((DECL_FUNCTION_SCOPE_P (decl)
7736                  && !var_in_maybe_constexpr_fn (decl))
7737                 || DECL_VIRTUAL_P (decl));
while in stmtexpr19.C the inner decl isn't in constexpr fn, it is in a
statement expression inside of a static variable initializer.
The initializer evaluates to constant expression (ADDR_EXPR of inner), so the
statement expression disappears and so there is no DECL_EXPR for the inner var
nor any reasonable spot to stick it to.

I think the options are somehow discover these before they are folded away and
mark them some way, so that we don't defer_p them or otherwise arrange for
rest_of_decl_compilation to be done on them later, or, as statement expressions
are a GNU extension, simply declare that such variables in statement
expressions cause it to be not a constant expression, only DECL_EXPRs of
var_in_maybe_constexpr_fn (decl) would be accepted.
Or, do we ever need to defer_p the static variables we are talking about here
(i.e. constexpr ones or ones with constant initializers, for which it really
doesn't matter where exactly we initialize them because they are initialized in
.rodata already.

  parent reply	other threads:[~2023-02-08 17:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-07 18:36 [Bug ipa/108702] New: [13 Regression] ICE in get_partitioning_class, at symtab.cc:2096 asolokha at gmx dot com
2023-02-08 14:27 ` [Bug ipa/108702] [13 Regression] ICE in get_partitioning_class, at symtab.cc:2096 since r13-4161-g32d16fe9d7e347bc marxin at gcc dot gnu.org
2023-02-08 16:08 ` jakub at gcc dot gnu.org
2023-02-08 17:27 ` jakub at gcc dot gnu.org [this message]
2023-03-04  8:55 ` [Bug c++/108702] " cvs-commit at gcc dot gnu.org
2023-03-04  9:24 ` jakub 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-108702-4-Xbm0Q9YrVG@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).