public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/20776] New: FE_DOWNWARD testcase results differ in -m32 and -m64. OK or bug?
@ 2005-04-05 22:26 jgrimm2 at us dot ibm dot com
  2005-04-05 22:37 ` [Bug target/20776] " pinskia at gcc dot gnu dot org
  2005-04-05 22:37 ` dje at gcc dot gnu dot org
  0 siblings, 2 replies; 3+ messages in thread
From: jgrimm2 at us dot ibm dot com @ 2005-04-05 22:26 UTC (permalink / raw)
  To: gcc-bugs

Might not be a bug even, but I haven't had much luck in finding a definitive
answer.   I get different output depending on whether I compile the following
testcase as 32-bit vs 64-bit on linux-ppc64 (gcc-3.4 and gcc-4). 

include <stdio.h>
#include <fenv.h>

int main()
{
 int x=1023, y=1023;
 double z;

 fesetround(FE_DOWNWARD);
 z = (double)(x-y);
 printf ("z = %e\n", z);

 return 0;
}


If I compile this as '-O0 -m32' I get a result of:

 z = -0.000000e+00

But compiling for 64-bit, '-O0 -m64' I get result of:

 z = 0.000000e+00

This was noticed by someone testing linux-ppc glibc::logb(1) after having set
the rounding mode to FE_DOWNWARD and getting a -0.0 result (glibc has similar
code as testcase above).  

GCC bug vs GLIBC bug vs User Error?

-- 
           Summary: FE_DOWNWARD testcase results differ in -m32 and -m64. OK
                    or bug?
           Product: gcc
           Version: 3.4.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jgrimm2 at us dot ibm dot com
                CC: gcc-bugs at gcc dot gnu dot org
GCC target triplet: ppc64-unknown-linux


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


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

* [Bug target/20776] FE_DOWNWARD testcase results differ in -m32 and -m64. OK or bug?
  2005-04-05 22:26 [Bug target/20776] New: FE_DOWNWARD testcase results differ in -m32 and -m64. OK or bug? jgrimm2 at us dot ibm dot com
@ 2005-04-05 22:37 ` pinskia at gcc dot gnu dot org
  2005-04-05 22:37 ` dje at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-04-05 22:37 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-04-05 22:37 -------
-m64 makes use of fcfid while 32bit PPC uses the following construct:
        xoris r3,r3,0x8000
        lis r0,0x4330
        stw r3,-4(r1)
        lis r2,ha16(LC0)
        stw r0,-8(r1)
        lfd f0,-8(r1)
        lfs f1,lo16(LC0)(r2)
        fsub f1,f0,f1
        blr

so there is subtraction which causes the difference.

But I don't know if this is gcc problem or just an user not expecting -0.

-- 


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


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

* [Bug target/20776] FE_DOWNWARD testcase results differ in -m32 and -m64. OK or bug?
  2005-04-05 22:26 [Bug target/20776] New: FE_DOWNWARD testcase results differ in -m32 and -m64. OK or bug? jgrimm2 at us dot ibm dot com
  2005-04-05 22:37 ` [Bug target/20776] " pinskia at gcc dot gnu dot org
@ 2005-04-05 22:37 ` dje at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: dje at gcc dot gnu dot org @ 2005-04-05 22:37 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From dje at gcc dot gnu dot org  2005-04-05 22:37 -------
this is incorrect

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


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


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

end of thread, other threads:[~2005-04-05 22:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-05 22:26 [Bug target/20776] New: FE_DOWNWARD testcase results differ in -m32 and -m64. OK or bug? jgrimm2 at us dot ibm dot com
2005-04-05 22:37 ` [Bug target/20776] " pinskia at gcc dot gnu dot org
2005-04-05 22:37 ` dje 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).