$ cat b.cc #include <iostream> using namespace std;
void init(long double& n, int k) { n = k; } int main() { long double n; init(n, -2); cout << n << endl; } $ g++ b.cc ; ./a.out -2 $ g++ -m64 b.cc ; ./a.out 4.29497e+09 $ g++ -O1 -m64 b.cc ; ./a.out -2 $ g++ -O2 -m64 b.cc ; ./a.out -2 $ g++ -O3 -m64 b.cc ; ./a.out -2 $ g++ -mhard-quad-float -m64 b.cc ; ./a.out -2 $ gcc -v Using built-in specs. Target: sparc-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Debian 4.3.1-2' --with-bugurl=file:///usr/share/doc/gcc-4.3/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.3 --program-suffix=-4.3 --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-mpfr --with-cpu=v8 --with-long-double-128 --enable-checking=release --build=sparc-linux-gnu --host=sparc-linux-gnu --target=sparc-linux-gnu Thread model: posix gcc version 4.3.1 (Debian 4.3.1-2) $ cat /proc/cpuinfo cpu : TI UltraSparc II (BlackBird) fpu : UltraSparc II integrated FPU prom : OBP 3.16.1 1999/04/19 07:55 type : sun4u ncpus probed : 2 ncpus active : 2 D$ parity tl1 : 0 I$ parity tl1 : 0 Cpu0ClkTck : 0000000017d78400 Cpu1ClkTck : 0000000017d78400 MMU Type : Spitfire State: CPU0: online CPU1: online -- Summary: long double is buggy on sparc64 Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: target AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: bagnara at cs dot unipr dot it GCC host triplet: sparc64-unknown-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37661