------- Additional Comments From rguenth at gcc dot gnu dot org 2005-09-04
16:25 -------
For
struct Foo {};
void foo(const Foo&);
void bar(Foo);
void fooc(void)
{
foo(Foo());
}
void barc(void)
{
bar(Foo());
}
we get different initializers for the Foo& and the Foo case:
void fooc() ()
{
struct Foo D.1594;
<bb 0>:
D.1594 = {};
foo (&D.1594);
return;
}
void barc() ()
{
struct Foo D.1613;
<bb 0>:
D.1613 = 0;
bar (D.1613) [tail call];
return;
}
The former looks correct and does not produce initialization code
for the temporary. The latter produces an unneccessary (uninitialized)
initialization of the pass-by-value stack slot on x86.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20408