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
* [Bug optimization/13643] __builtin_constant_p() fails to notice known value of member variable 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 ` bryner at brianryner dot com 2004-01-11 16:07 ` pinskia at gcc dot gnu dot org ` (2 subsequent siblings) 3 siblings, 0 replies; 5+ messages in thread From: bryner at brianryner dot com @ 2004-01-11 9:51 UTC (permalink / raw) To: gcc-bugs ------- Additional Comments From bryner at brianryner dot com 2004-01-11 09:51 ------- Created an attachment (id=5450) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=5450&action=view) testcase Compiled with: c++ -Os -c -o test_const.o test_const.cpp $ c++ -v Reading specs from /usr/gcc34/lib/gcc/i686-pc-linux-gnu/3.4.0/specs Configured with: ../gcc/configure --prefix=/usr/gcc34 --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --enable-languages=c,c++ --host=i686-pc-linux-gnu Thread model: posix gcc version 3.4.0 20040110 (experimental) -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13643 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug optimization/13643] __builtin_constant_p() fails to notice known value of member variable 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 3 siblings, 0 replies; 5+ messages in thread From: pinskia at gcc dot gnu dot org @ 2004-01-11 16:07 UTC (permalink / raw) To: gcc-bugs ------- Additional Comments From pinskia at gcc dot gnu dot org 2004-01-11 16:07 ------- Confirmed on the mainline but ... -- What |Removed |Added ---------------------------------------------------------------------------- Severity|normal |enhancement Status|UNCONFIRMED |NEW Ever Confirmed| |1 Keywords| |pessimizes-code Last reconfirmed|0000-00-00 00:00:00 |2004-01-11 16:07:05 date| | Target Milestone|--- |tree-ssa Version|unknown |3.4.0 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13643 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug optimization/13643] __builtin_constant_p() fails to notice known value of member variable 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 3 siblings, 0 replies; 5+ messages in thread From: pinskia at gcc dot gnu dot org @ 2004-01-11 16:07 UTC (permalink / raw) To: gcc-bugs ------- Additional Comments From pinskia at gcc dot gnu dot org 2004-01-11 16:07 ------- Fixed on the tree-ssa already so suspending it. -- What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |SUSPENDED http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13643 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug tree-optimization/13643] __builtin_constant_p() fails to notice known value of member variable 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 ` (2 preceding siblings ...) 2004-01-11 16:07 ` pinskia at gcc dot gnu dot org @ 2004-05-13 20:17 ` pinskia at gcc dot gnu dot org 3 siblings, 0 replies; 5+ messages in thread From: pinskia at gcc dot gnu dot org @ 2004-05-13 20:17 UTC (permalink / raw) To: gcc-bugs ------- Additional Comments From pinskia at gcc dot gnu dot org 2004-05-13 11:33 ------- Fixed for 3.5.0 by the merge of the tree-ssa. -- What |Removed |Added ---------------------------------------------------------------------------- Status|SUSPENDED |RESOLVED Component|rtl-optimization |tree-optimization Resolution| |FIXED Target Milestone|tree-ssa |3.5.0 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).