[clug] gcc3.3 + 3dNOW bug? # Interesting.

Francis James Whittle fudje at phreaker.net
Sat Sep 11 12:23:31 GMT 2004


The interesting thing being that our source seems (or seemed) to be
dependant on the architecture type switch.  I can't reproduce that
behaviour in my modifications to it.
It still damages in 3.4, although in yet another different way.

Using the C source code attached (because getting rid of C++ is always
fun.  Also, interestingly enough, it damages a in a different way.):

$ gcc-3.4 -o test -O3 -fno-strict-aliasing -march=athlon -m3dnow 3dnow-
test.c
$ ./test a = 1 2
b = 3 4
mul
a = nan nan
b = 3 4
c = 3 8

gcc 3.3 test (C):

$ gcc-3.3 -o test -O3 -fno-strict-aliasing -march=athlon -m3dnow 3dnow-
test.c
$ ./test a = 1 2
b = 3 4
mul
a = 1 nan
b = 3 4
c = 3 8

gcc 3.2:

$ gcc-3.2 -o test -O3 -fno-strict-aliasing -march=athlon -m3dnow 3dnow-
test.c
$ ./test
a = 1 2
b = 3 4
mul
a = 1 0
b = 3 4
c = 3 8


And with no actual optimisations (Always the same on gcc 3.[234]):

$ gcc-3.4 -o test -O0 -fno-strict-aliasing -march=athlon -m3dnow 3dnow-
test.c
$ ./test
a = 1 2
b = 3 4
mul
a = 1 nan
b = 3 4
c = 3 8

Without-apparently-pointless-flags-test:

$ gcc-3.4 -o test -O3 -march=athlon 3dnow-test.c
$ ./test
a = 1 2
b = 3 4
mul
a = nan nan
b = 3 4
c = 3 8

And for the fun of it (Optimized gives incorrect result):

$ gcc-3.4 -o test -O0 -march=k6-2 -m3dnow 3dnow-test.c
$ ./test
a = 1 2
b = 3 4
mul
a = nan nan
b = 3 4
c = 3 8

Oh how bored I am.

On Sat, 2004-09-11 at 12:28 +1000, Paul Matthews wrote:
> Hi Guys,
> 
> I was mucking around with 3dNOW and gcc3.3, and I think I've found a 
> bug. Thought I might post it here first. As you can see, the result in 
> vector 'c' is correct, but the input vector 'a' has been damaged.
> 
-*- snip -*-

> $ g++ -o test -O3 -fno-strict-aliasing -march=athlon-xp
>        -mmmx -msse -m3dnow test.cc
> $ ./test
> a = 1 2
> b = 3 4
> mul
> a = 1 0
> b = 3 4
> c = 3 8
> 


More information about the linux mailing list