This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/6880] Inefficient Copy constructor generation


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]