public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug optimization/13643] New: __builtin_constant_p() fails to notice known value of member variable
@ 2004-01-11  9:50 bryner at brianryner dot com
  2004-01-11  9:51 ` [Bug optimization/13643] " bryner at brianryner dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: bryner at brianryner dot com @ 2004-01-11  9:50 UTC (permalink / raw)
  To: gcc-bugs

The testcase can probably demonstrate this better than I can verbalize it. 
Basically, I have an object allocated on the stack that initializes a member
variable to a constant.  I then call an inlined function on the object which
wants to use __builtin_constant_p() on the member variable.  The constant check
evaluates to false... it seems like the compiler should have sufficient
information to determine the value of the member variable.  In particular, note
that for struct B in the test case, the |if| in the inline function is optimized
away at compile time.  Therefore it seems like __builtin_constant_p() should
evaluate to true in struct A.

(It should be fairly obvious what I'm trying to do here -- eliminate an
unnecessary call to delete(NULL) when mPtr is known to be null at compile time).

-- 
           Summary: __builtin_constant_p() fails to notice known value of
                    member variable
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bryner at brianryner dot com
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: i686-pc-linux-gnu


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


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

end of thread, other threads:[~2004-05-13 11:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-11  9:50 [Bug optimization/13643] New: __builtin_constant_p() fails to notice known value of member variable bryner at brianryner dot com
2004-01-11  9:51 ` [Bug optimization/13643] " bryner at brianryner dot com
2004-01-11 16:07 ` pinskia at gcc dot gnu dot org
2004-01-11 16:07 ` pinskia at gcc dot gnu dot org
2004-05-13 20:17 ` [Bug tree-optimization/13643] " 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).