From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 380873858439; Wed, 8 Feb 2023 17:27:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 380873858439 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1675877276; bh=sZlCvqhDX2WcourXykmrvCyXo7RizDViEkliT3wLXAI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=JasjF5ChH2dD5131bWKrL3AXJIqZGx/1Yqv5/tF/US5SYn0A7wdMbOQ/PAq/X0aga TAdwAbHCxx3cJKb8doQ7fraVGMc7ZzUwg4GFE6EHVUySOP+KbGWsp0YV8o1+Ny73D0 X3koJjVjQgpQ47cm57muQyPcMG0lp3vS3yt0+tAE= From: "jakub at gcc dot 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: lto X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: component priority cc target_milestone Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D108702 Jakub Jelinek 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 --- 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 no= w.=20 */ 7735 defer_p =3D ((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 t= he 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 express= ions 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 he= re (i.e. constexpr ones or ones with constant initializers, for which it really doesn't matter where exactly we initialize them because they are initialize= d in .rodata already.=