public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "gjl at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/114779] __builtin_constant_p does not work in inline functions
Date: Fri, 19 Apr 2024 08:44:00 +0000	[thread overview]
Message-ID: <bug-114779-4-GcWAAVGNsl@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-114779-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #2 from Georg-Johann Lay <gjl at gcc dot gnu.org> ---
Notice that when &SFR is used directly in __builtin_constant_p without an
inline function, then the code works as expected:

int main (void)
{
    if (__builtin_constant_p (& SFR))
        __asm (".warning \"psfr = %0 is constant\"" :: "n" (& SFR));
    return 0;
}

$ gcc bar.c -c -O2
Assembler messages:
Warning: psfr = $256 is constant

  parent reply	other threads:[~2024-04-19  8:44 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-19  8:28 [Bug tree-optimization/114779] New: " gjl at gcc dot gnu.org
2024-04-19  8:42 ` [Bug tree-optimization/114779] " jakub at gcc dot gnu.org
2024-04-19  8:44 ` gjl at gcc dot gnu.org [this message]
2024-04-19  8:49 ` jakub at gcc dot gnu.org
2024-04-19  8:55 ` gjl at gcc dot gnu.org
2024-04-19  9:03 ` jakub at gcc dot gnu.org
2024-04-19  9:20 ` gjl at gcc dot gnu.org
2024-04-19  9:38 ` hubicka at gcc dot gnu.org
2024-04-19 10:10 ` rguenth at gcc dot gnu.org
2024-04-19 10:43 ` gjl at gcc dot gnu.org
2024-04-19 11:36 ` gjl 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-114779-4-GcWAAVGNsl@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).