This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/6880] Inefficient Copy constructor generation
- From: "bangerth at dealii dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 24 Jul 2003 14:38:58 -0000
- Subject: [Bug c++/6880] Inefficient Copy constructor generation
- References: <20020531003601.6880.dann@godzilla.ics.uci.edu>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=6880
------- Additional Comments From bangerth at dealii dot org 2003-07-24 14:38 -------
At least from a language viewpoint, there is certainly no bug in the generated
code: in one case, a stack space for the variable "factor" is allocated
and the correct values are written into it. Then the values are copied to
Yy. In the other case, the stores to the local variable are eliminated
entirely (they're dead, after all). Since this doesn't change the semantics
of the program, this is ok.
The question rather is: how come that the compiler can elide construction
of "factor" when a user-defined copy constructor is given, and can't
when none is given? In addition, I fail to see where the copy
constructor comes into play at all -- it shouldn't be used in this example.
W.