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]

gcc 2.96 optimization bug on RedHat7.0/alpha


with -O2 i get the wrong answer

                [gat@LX gat]$ gcc -g -O2 a.c -o a
                [gat@LX gat]$ ./a
                FlooR: x = 22.16, i0=1, i1=536871996


with -O i get a passable answer

                [gat@LX gat]$ gcc -g -O a.c -o a
                [gat@LX gat]$ ./a
                FlooR: x = 22.16, i0=1077291253, i1=-1030792151


BTW what exactly is the page one uses to submit/fill in the bug report
for gcc et al ?

pgm is :

[gat@LX gat]$ cat a.c
double floor ( double );

main()
{
 double d = 22.16;
 floor( d );
}

double
floor( double x )
{
        int i0,i1;
        i0 = *((int*)&x+1);
        i1 = *(int*)&x;

printf("FlooR: x = %g, i0=%d, i1=%d\n",x, i0, i1);

        return x;
}




-----------------------------------------------------------
[gat@LX gat]$ gcc -v -save-temps  -g -O2 a.c -o a
Reading specs from /usr/lib/gcc-lib/alpha-redhat-linux/2.96/specs
gcc version 2.96 20000731 (Red Hat Linux 7.0)
 /usr/lib/gcc-lib/alpha-redhat-linux/2.96/cpp0 -lang-c -v -D__GNUC__=2
-D__GNUC_MINOR__=96 -D__GNUC_PATCHLEVEL__=0 -Dlinux -Dunix -D_LONGLONG
-D__alpha__ -D__ELF__ -D__linux__ -D__unix__ -D_LONGLONG -D__alpha__
-D__ELF__ -D__linux -D__unix -Asystem(linux) -D__OPTIMIZE__ -g
-D__LANGUAGE_C__ -D__LANGUAGE_C -DLANGUAGE_C -Acpu(alpha)
-Amachine(alpha) -D__alpha -D__alpha__ -D__alpha_ev4__ -Acpu(ev4) a.c
a.i
GNU CPP version 2.96 20000731 (Red Hat Linux 7.0) (cpplib)
 (Alpha GNU/Linux for ELF)
ignoring nonexistent directory "/usr/alpha-redhat-linux/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /usr/lib/gcc-lib/alpha-redhat-linux/2.96/include
 /usr/include
End of search list.
 /usr/lib/gcc-lib/alpha-redhat-linux/2.96/cc1 a.i -quiet -dumpbase a.c
-g -O2 -version -o a.s
GNU C version 2.96 20000731 (Red Hat Linux 7.0) (alpha-redhat-linux)
compiled by GNU C version 2.96 20000731 (Red Hat Linux 7.0).
 as -o a.o a.s
 /usr/lib/gcc-lib/alpha-redhat-linux/2.96/collect2 -m elf64alpha -O3
-dynamic-linker /lib/ld-linux.so.2 -o a
/usr/lib/gcc-lib/alpha-redhat-linux/2.96/../../../crt1.o
/usr/lib/gcc-lib/alpha-redhat-linux/2.96/../../../crti.o
/usr/lib/gcc-lib/alpha-redhat-linux/2.96/crtbegin.o
-L/usr/lib/gcc-lib/alpha-redhat-linux/2.96
-L/usr/lib/gcc-lib/alpha-redhat-linux/2.96/../../.. a.o -lgcc -lc -lgcc
/usr/lib/gcc-lib/alpha-redhat-linux/2.96/crtend.o
/usr/lib/gcc-lib/alpha-redhat-linux/2.96/../../../crtn.o
[gat@LX gat]$



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