[TESTCASE] Minimized testcase for AltiVec segfault
Daniel Egger
degger@fhm.edu
Tue Feb 26 05:17:00 GMT 2002
Hija,
the attached testcase will segfault on powerpc-linux when compiled with
-O0.
egger@sonja:~$ /opt/gcc/bin/gcc -da -maltivec -save-temps -O0 -mregnames
test2.c -o test2 -Wall
test2.c: In function `do_something':
test2.c:7: warning: unused variable `zeros'
egger@sonja:~$ ./test2
Segmentation fault
Works with -O2:
egger@sonja:~$ /opt/gcc/bin/gcc -da -maltivec -save-temps -O2 -mregnames
test2.c -o test2 -Wall
test2.c: In function `do_something':
test2.c:7: warning: unused variable `zeros'
egger@sonja:~$ ./test2
egger@sonja:~$
do_something:
stwu %r1,-96(%r1)
stw %r31,92(%r1)
mr %r31,%r1
stw %r3,8(%r31)
lis %r9,.LC0@ha
la %r9,.LC0@l(%r9)
lvx %v0,0,%r9
li %r0,32
stvx %v0,%r31,%r0
li %r0,32
lvx %v0,%r31,%r0
li %r0,16
stvx %v0,%r31,%r0
lwz %r0,8(%r31)
stw %r0,48(%r31)
lwz %r9,48(%r31)
lvx %v0,0,%r9 <--- This is an offending line.
li %r0,56
stvx %v0,%r31,%r0
lwz %r9,48(%r31)
li %r0,56
lvx %v0,%r31,%r0
stvx %v0,0,%r9 <--- This is an offending line.
lwz %r11,0(%r1)
lwz %r31,-4(%r11)
mr %r1,%r11
blr
One problem with this marked lines is that there is no direct vector
load or vector store with the second argument being 0 to directly
address the memory at the pointer in the third argument which gcc seem
to assume exists.
Even worse for the store is that %r9 points to 0 and %r0 is 56 (while
it is probably assumed to be ignored) which means that address
generation is wrong anyway even if the syntax was right.
--
Servus,
Daniel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test2.c
Type: text/x-c
Size: 424 bytes
Desc:
URL: <https://gcc.gnu.org/pipermail/gcc/attachments/20020226/06b7882d/attachment.bin>
More information about the Gcc
mailing list