This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: optimization/7247: copy constructor missing when inlining enabled for i386
- From: Ewgenij Gawrilow <gawrilow at math dot TU-Berlin dot DE>
- To: nathan at gcc dot gnu dot org
- Cc: gcc-bugs at gcc dot gnu dot org, gcc-gnats at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org
- Date: Wed, 10 Jul 2002 11:07:57 +0200
- Subject: Re: optimization/7247: copy constructor missing when inlining enabled for i386
- References: <20020709190706.13568.qmail@sources.redhat.com>
>>>>> "nathan" == nathan <nathan@gcc.gnu.org> writes:
nathan> Synopsis: copy constructor missing when inlining enabled
nathan> for i386
nathan> If I understand you correctly, you are
nathan> complaining that a copy ctor call is being optimized away.
nathan> This is allowed, under [12.8]/15, even if the copy ctor
nathan> has side-effects
The class whose construction fails is defined in my test case
as follows:
struct double_zero {
const double epsilon;
double_zero(const double& epsilon_arg=1e-8) : epsilon(epsilon_arg) { }
};
One would expect from a copy constructor, especially from the implicit
one, that it would copy the value of the instance variable
"epsilon". I don't think this could fall under the definition of a side effect.
Alternatively, if optimization according to the clause [12.8]/15 comes
into effect here, as you mean, then it is the constructor
double_zero(const double&) that is being forgotten. At any rate, the
"epsilon" variable contains garbage after the construction, as shows up
in the debugging output.
Encouraged by such a quick response, I hope for a similarly quick fix :-)
With best regards,
Ewgenij Gawrilow