This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/16568] [3.5 regression] wrong code for conditional in initializer
- From: "bangerth at dealii dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 15 Jul 2004 17:21:18 -0000
- Subject: [Bug c++/16568] [3.5 regression] wrong code for conditional in initializer
- References: <20040715161157.16568.snyder@fnal.gov>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From bangerth at dealii dot org 2004-07-15 17:21 -------
Hm, I tried to construct a testcase where this uninitialized value
would actually do harm. So I tried this:
------------------
void show_address (const void *);
struct ystr {
ystr (int) {};
ystr (const ystr& y) { show_address(this); show_address(&y); };
};
struct C
{
C(ystr* value);
ystr _object;
};
C::C(ystr* value)
: _object(value == 0 ? 0 : *value)
{
}
------------------------
C::C is compiled to the same as before, i.e. we end up with an
uninitialize value in (%esp). But then, this is ystr::ystr (const ystr&):
------------------------
_ZN4ystrC1ERKS_:
pushl %ebp
movl %esp, %ebp
subl $8, %esp
movl 8(%ebp), %eax
movl %eax, (%esp)
call _Z12show_addressPKv
movl 12(%ebp), %eax
movl %eax, (%esp)
call _Z12show_addressPKv
leave
ret
---------------
Whatever used to be in %(esp) isn't used here at all, i.e. both
the addresses of the argument as well as of *this are unaffected.
Or do I miss something? Do you have a testcase where the uninitializedness
actually hurts you?
W.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16568