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++/85944] Address of temporary bound to a function parameter at global scope not considered constexpr
Date: Tue, 25 Oct 2022 15:59:39 +0000	[thread overview]
Message-ID: <bug-85944-4-rvr8iBtwtf@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-85944-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
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 function
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.

  parent reply	other threads:[~2022-10-25 15:59 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-85944-4@http.gcc.gnu.org/bugzilla/>
2022-01-14 14:21 ` ppalka at gcc dot gnu.org
2022-07-06 10:37 ` redi at gcc dot gnu.org
2022-07-06 10:44 ` redi at gcc dot gnu.org
2022-10-25  6:57 ` rguenth at gcc dot gnu.org
2022-10-25 15:59 ` jakub at gcc dot gnu.org [this message]
2023-02-23  3:10 ` ppalka at gcc dot gnu.org
2023-04-18  9:55 ` redi at gcc dot gnu.org
2023-05-26  3:14 ` pinskia at gcc dot gnu.org
2023-05-26  3:28 ` [Bug c++/85944] Address of temporary " pinskia at gcc dot gnu.org
2023-07-27 17:54 ` pinskia 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-85944-4-rvr8iBtwtf@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).