This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
Re: optimization/8878: miscompilation with -O and SSE
- From: reichelt at igpm dot rwth-aachen dot de
- To: gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, kronoz at tiscali dot it, nobody at gcc dot gnu dot org
- Date: 11 Dec 2002 14:08:15 -0000
- Subject: Re: optimization/8878: miscompilation with -O and SSE
- Reply-to: reichelt at igpm dot rwth-aachen dot de, gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, kronoz at tiscali dot it, nobody at gcc dot gnu dot org, gcc-gnats at gcc dot gnu dot org
Synopsis: miscompilation with -O and SSE
State-Changed-From-To: open->analyzed
State-Changed-By: reichelt
State-Changed-When: Wed Dec 11 06:08:13 2002
State-Changed-Why:
Confirmed.
Here's a cleaned-up testcase (which does not suffer from
aliasing problems as the original one, where &c is casted):
----------------------------snip here-------------------------
#include <stdio.h>
typedef int v4sf __attribute__((mode(V4SF)));
int main(void)
{
v4sf v = {1.0, 2.0, 3.0, 4.0};
union { v4sf v; float f[4]; } u;
u.v = __builtin_ia32_mulps(v,v);
printf("%f %f %f %f\n", u.f[0], u.f[1], u.f[2], u.f[3]);
return 0;
}
----------------------------snip here-------------------------
Compiling this with "gcc -O -msse" on a i686-pc-linux-gnu machine
results in an executable that prints
16.000000 0.000000 0.000000 0.000000
instead of
1.000000 4.000000 9.000000 16.000000
as expeceted. Replacing "mulps" by "addps" will generate equally wrong results.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8878