public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/114779] New: __builtin_constant_p does not work in inline functions
@ 2024-04-19  8:28 gjl at gcc dot gnu.org
  2024-04-19  8:42 ` [Bug tree-optimization/114779] " jakub at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: gjl at gcc dot gnu.org @ 2024-04-19  8:28 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 114779
           Summary: __builtin_constant_p does not work in inline functions
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gjl at gcc dot gnu.org
  Target Milestone: ---

Take the following C test case with a special function register (SFR)
definition at a constant address:

#define SFR (*(volatile int*) 0x100)

static __inline__ __attribute__((__always_inline__))
void test_bcp (int volatile *psfr)
{
    if (! __builtin_constant_p (psfr))
        __asm (".error \"psfr is not constant\"");
}

int main (void)
{
    test_bcp (& SFR);
    return 0;
}

Then compile with:

$ gcc bar.c -c -O2
Assembler messages:
Error: psfr is not constant

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2024-04-19 11:36 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-19  8:28 [Bug tree-optimization/114779] New: __builtin_constant_p does not work in inline functions 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
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

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).