public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/37661]  New: long double is buggy on sparc64
@ 2008-09-27 16:58 bagnara at cs dot unipr dot it
  2008-09-27 17:43 ` [Bug target/37661] " jsm28 at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: bagnara at cs dot unipr dot it @ 2008-09-27 16:58 UTC (permalink / raw)
  To: gcc-bugs

$ 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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug target/37661] long double is buggy on sparc64
  2008-09-27 16:58 [Bug target/37661] New: long double is buggy on sparc64 bagnara at cs dot unipr dot it
@ 2008-09-27 17:43 ` jsm28 at gcc dot gnu dot org
  2008-09-27 18:04 ` bagnara at cs dot unipr dot it
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2008-09-27 17:43 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from jsm28 at gcc dot gnu dot org  2008-09-27 17:42 -------
SPARC64 conversions from integers to long double were fixed for 4.4 by my
patch:
http://gcc.gnu.org/ml/gcc-patches/2008-08/msg00910.html


-- 

jsm28 at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.4.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37661


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug target/37661] long double is buggy on sparc64
  2008-09-27 16:58 [Bug target/37661] New: long double is buggy on sparc64 bagnara at cs dot unipr dot it
  2008-09-27 17:43 ` [Bug target/37661] " jsm28 at gcc dot gnu dot org
@ 2008-09-27 18:04 ` bagnara at cs dot unipr dot it
  2008-09-27 18:21 ` joseph at codesourcery dot com
  2008-09-27 19:05 ` [Bug target/37661] wrong conversion from integer to long double ebotcazou at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: bagnara at cs dot unipr dot it @ 2008-09-27 18:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from bagnara at cs dot unipr dot it  2008-09-27 18:03 -------
This is good news.  However, is there any known workaround for versions before
4.4?


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37661


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug target/37661] long double is buggy on sparc64
  2008-09-27 16:58 [Bug target/37661] New: long double is buggy on sparc64 bagnara at cs dot unipr dot it
  2008-09-27 17:43 ` [Bug target/37661] " jsm28 at gcc dot gnu dot org
  2008-09-27 18:04 ` bagnara at cs dot unipr dot it
@ 2008-09-27 18:21 ` joseph at codesourcery dot com
  2008-09-27 19:05 ` [Bug target/37661] wrong conversion from integer to long double ebotcazou at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: joseph at codesourcery dot com @ 2008-09-27 18:21 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from joseph at codesourcery dot com  2008-09-27 18:20 -------
Subject: Re:  long double is buggy on sparc64

On Sat, 27 Sep 2008, bagnara at cs dot unipr dot it wrote:

> This is good news.  However, is there any known workaround for versions before
> 4.4?

If you want a workaround rather than backporting the patch, I suppose you 
could do all your conversions to long double from long long or unsigned 
long long instead of from 32-bit integer types, though the compiler might 
optimize away the intermediate conversions and so stop such a workaround 
from working.  I'd advise backporting the patch instead.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37661


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug target/37661] wrong conversion from integer to long double
  2008-09-27 16:58 [Bug target/37661] New: long double is buggy on sparc64 bagnara at cs dot unipr dot it
                   ` (2 preceding siblings ...)
  2008-09-27 18:21 ` joseph at codesourcery dot com
@ 2008-09-27 19:05 ` ebotcazou at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2008-09-27 19:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from ebotcazou at gcc dot gnu dot org  2008-09-27 19:04 -------
> If you want a workaround rather than backporting the patch, I suppose you 
> could do all your conversions to long double from long long or unsigned 
> long long instead of from 32-bit integer types, though the compiler might 
> optimize away the intermediate conversions and so stop such a workaround 
> from working.  I'd advise backporting the patch instead.

Backport to 4.3 branch is OK by me.


-- 

ebotcazou at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ebotcazou at gcc dot gnu dot
                   |                            |org
            Summary|long double is buggy on     |wrong conversion from
                   |sparc64                     |integer to long double
            Version|unknown                     |4.3.1


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37661


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-09-27 19:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-27 16:58 [Bug target/37661] New: long double is buggy on sparc64 bagnara at cs dot unipr dot it
2008-09-27 17:43 ` [Bug target/37661] " jsm28 at gcc dot gnu dot org
2008-09-27 18:04 ` bagnara at cs dot unipr dot it
2008-09-27 18:21 ` joseph at codesourcery dot com
2008-09-27 19:05 ` [Bug target/37661] wrong conversion from integer to long double ebotcazou at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).