From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C1D833856DD7; Tue, 25 Oct 2022 15:59:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C1D833856DD7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1666713580; bh=i4rigjKFSWO/D1Gg7AYftdnye5xzlfFZ63pze2bWZiQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=wjjXNFyalSAEjb6a2cSsRS0jDdgXB9RKSh05VjWDnrY2yqrViENWiw+Wd51NOfqcE bECcpmijE0hNHEa5eA2egH6Sdql5dJZtGkQDjjqNtp7P/Ux7gxtnOtzI9Qn1vZ4hVM OMjC7hIWAWtzpVOJeF2rqN2bAyFkIlkAOkmuA//o= From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/85944] Address of temporary bound to a function parameter at global scope not considered constexpr Date: Tue, 25 Oct 2022 15:59:39 +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: 8.1.0 X-Bugzilla-Keywords: rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: 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=3D85944 --- Comment #7 from Jakub Jelinek --- I'm afraid the middle-end can't do here much. maybe_nonzero_address handles file scope vars (vars in symbol table) and automatic vars, but for the TARGET_EXPR temporaries created by force_target_expr -> build_local_temp if they are built outside of the func= tion it doesn't know anything about them until they are gimplified. They are artificial VAR_DECLs with NULL DECL_CONTEXT, their DECL_CONTEXT will be set only during gimplification when the static ctors function is created. So, either we'd need to mark such local temporaries some way that maybe_nonzero_address could assume that while they don't look like automatic vars yet, they will be ones later on (special attribute, or flag, etc.), or constexpr.cc would need to handle folding those cases itself.=