public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/14505] __builtin_constant_p(__func__) is not true
       [not found] <bug-14505-4@http.gcc.gnu.org/bugzilla/>
@ 2021-12-23  6:22 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-23  6:22 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|minor                       |enhancement

--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #6)
> Try:
> int
> foo ()
> {
>   static int a;
>   static const int b = 3;
>   static const char c[3] = "ab";
>   static const char *d = "cd";
>   static const char *const e = "ef";
>   return 1 * __builtin_constant_p (&a)
>          + 2 * __builtin_constant_p (&b)
>          + 4 *__builtin_constant_p (c)
>          + 8 * __builtin_constant_p (c[0])
>          + 16 *__builtin_constant_p (d)
>          + 32 * __builtin_constant_p (d[0])
>          + 64 *__builtin_constant_p (e)
>          + 128 * __builtin_constant_p (e[0]);
> }

What we get now is dependent on the optimization level and if it is C or C++
mode and even what version of the compiler (GCC 8+ has stablized it seems
though).
GCC 8+:
        -O0     -O1+
c         0     232 (8+32+64+128)
c++      64     232

GCC 6/7:
c         0     168 (8+32+128)
c++      64     232

GCC 4.5-5.x:
c/c++     0     168

GCC ???-4.4.x:
c         0     200 (128+64+8)
c++       0     136 (128+8)

4.1.2:
c         0     64
c++       0     128

clang:
c       192     232
c++11+  200     232
c++98   192     232

192 = 128+64; 200 = 128+64+8

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

* [Bug middle-end/14505] __builtin_constant_p(__func__) is not true
  2004-03-09 18:21 [Bug middle-end/14505] New: " alexr at spies dot com
  2004-03-09 19:49 ` [Bug middle-end/14505] " pinskia at gcc dot gnu dot org
@ 2004-06-08  3:31 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-06-08  3:31 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-06-08 03:31 -------
Well note that it cannot be a STRING_CST as the C99 standard defines __func__ as a variable.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2004-03-09 19:49:02         |2004-06-08 03:31:37
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14505


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

* [Bug middle-end/14505] __builtin_constant_p(__func__) is not true
  2004-03-09 18:21 [Bug middle-end/14505] New: " alexr at spies dot com
@ 2004-03-09 19:49 ` pinskia at gcc dot gnu dot org
  2004-06-08  3:31 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-03-09 19:49 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-03-09 19:49 -------
Confirmed on the mainline and on the tree-ssa.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |pessimizes-code
   Last reconfirmed|0000-00-00 00:00:00         |2004-03-09 19:49:02
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14505


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

end of thread, other threads:[~2021-12-23  6:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-14505-4@http.gcc.gnu.org/bugzilla/>
2021-12-23  6:22 ` [Bug middle-end/14505] __builtin_constant_p(__func__) is not true pinskia at gcc dot gnu.org
2004-03-09 18:21 [Bug middle-end/14505] New: " alexr at spies dot com
2004-03-09 19:49 ` [Bug middle-end/14505] " pinskia at gcc dot gnu dot org
2004-06-08  3:31 ` pinskia at gcc dot gnu dot 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).