optimization/8952: failure to optimize away trivial C++ object creation
Andrew Pinski
pinskia@physics.uc.edu
Sun Dec 15 12:36:00 GMT 2002
The following reply was made to PR optimization/8952; it has been noted by GNATS.
From: Andrew Pinski <pinskia@physics.uc.edu>
To: martin@xemacs.org
Cc: Andrew Pinski <pinskia@physics.uc.edu>, gcc-gnats@gcc.gnu.org
Subject: Re: optimization/8952: failure to optimize away trivial C++ object creation
Date: Sun, 15 Dec 2002 12:31:18 -0800
The following also does not optimize away on ppc-apple-darwin6.2 also
so it does not seems to be target specific.
Thanks,
Andrew Pinski
>> How-To-Repeat:
> Compile the following on x86 Linux using: g++ -S -O3
> examine the .s file generated.
>
> class Complex
> {
> private:
> const int real_;
> const int imag_;
>
> public:
> inline Complex (int real, int imag) : real_ (real), imag_ (imag) {}
> inline int Real() const { return real_; }
> inline int Imag() const { return imag_; }
>
> inline friend Complex operator+ (Complex z1, Complex z2)
> { return Complex (z1.real_ + z2.real_, z1.imag_ + z2.imag_); }
> };
>
> Complex foo () { return Complex(9,11); }
> Complex bar () { return Complex(1,2) + Complex(8,9); }
>> Fix:
>
>> Release-Note:
>> Audit-Trail:
>> Unformatted:
>
>
More information about the Gcc-prs
mailing list