optimization/7247: copy constructor missing when inlining enabled for i386
Ewgenij Gawrilow
gawrilow@math.TU-Berlin.DE
Wed Jul 10 02:36:00 GMT 2002
>>>>> "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
More information about the Gcc-bugs
mailing list