This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/20776] New: FE_DOWNWARD testcase results differ in -m32 and -m64. OK or bug?


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]