This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
gcc 2.95.2: Floating point parameter aliasing problems..
- To: gcc-bugs at gcc dot gnu dot org
- Subject: gcc 2.95.2: Floating point parameter aliasing problems..
- From: Jan Vroonhof <jan dot vroonhof at insignia dot com>
- Date: 13 Jul 2000 18:53:12 +0100
On i686 with -O2, gcc 2.95.2 generates an incorrect result on the
following code (which is based on code used in the pow() function of
fdlibm). (strict aliasing was _not_ enabled).
double a(double x, double y)
{
double y1;
y1 = y;
(*(int*)& y1 ) = 0;
return y1;
}
#include <stdio.h>
int main(int argc,char *argv[])
{
double eps;
eps = a(2.0,-52.0);
printf("%e",eps);
return 0;
}
This is the generated assembly for a():
pushl %ebp
movl %esp,%ebp
subl $24,%esp
xorl %eax,%eax
movl %eax,-8(%ebp)
movl %edx,-4(%ebp) <-- !
fldl -8(%ebp)
leave
ret