[Bug c++/16568] [3.5 regression] wrong code for conditional in initializer
bangerth at dealii dot org
gcc-bugzilla@gcc.gnu.org
Thu Jul 15 17:21:00 GMT 2004
------- 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
More information about the Gcc-bugs
mailing list