[TESTCASE] gcc miscompiles Altivec code
Daniel Egger
degger@fhm.edu
Tue Feb 26 05:17:00 GMT 2002
Am Die, 2002-02-26 um 03.45 schrieb Dale Johannesen:
> Note that the posted testcase prints out the value after only one transpose
>
> ...v1[7] = vec[7];
>
> Transpose (v1, v2);
> Transpose (v2, v1);
>
> vec[0] = v2[0];... // v1 value lost
>
> so the right answer is really
>
> 1 9 17 25 33 41 49 57
> 2 10 18 26 34 42 50 58
> 3 11 19 27 35 43 51 59
> 4 12 20 28 36 44 52 60
> 5 13 21 29 37 45 53 61
> 6 14 22 30 38 46 54 62
> 7 15 23 31 39 47 55 63
> 8 16 24 32 4 48 56 64
Yes, you're right. I sent the wrong version of the code. Sorry.
I attached the correct version of it.
It still doesn't work with -O0 here.
egger@sonja:~$ /opt/gcc/bin/gcc -da -maltivec -save-temps -O -mregnames
test.c -
o test -Wall
test.c: In function `do_something':
test.c:41: warning: unused variable `zeros'
egger@sonja:~$ ./test
Unaltered
1 2 3 4 5 6 7 8
9 10 11 12 13 14 15 16
17 18 19 20 21 22 23 24
25 26 27 28 29 30 31 32
33 34 35 36 37 38 39 40
41 42 43 44 45 46 47 48
49 50 51 52 53 54 55 56
57 58 59 60 61 62 63 64
After double transposing
1 2 3 4 5 6 7 8
9 10 11 12 13 14 15 16
17 18 19 20 21 22 23 24
25 26 27 28 29 30 31 32
33 34 35 36 37 38 39 40
41 42 43 44 45 46 47 48
49 50 51 52 53 54 55 56
57 58 59 60 61 62 63 64
egger@sonja:~$ /opt/gcc/bin/gcc -da -maltivec -save-temps -O0 -mregnames
test.c
-o test -Wall
test.c: In function `do_something':
test.c:41: warning: unused variable `zeros'
egger@sonja:~$ ./test
Unaltered
1 2 3 4 5 6 7 8
9 10 11 12 13 14 15 16
17 18 19 20 21 22 23 24
25 26 27 28 29 30 31 32
33 34 35 36 37 38 39 40
41 42 43 44 45 46 47 48
49 50 51 52 53 54 55 56
57 58 59 60 61 62 63 64
Segmentation fault
--
Servus,
Daniel
More information about the Gcc
mailing list