[Bug target/26636] New: use of r1-r3 across __sdivsi3_4 call
rmansfield at qnx dot com
gcc-bugzilla@gcc.gnu.org
Fri Mar 10 18:16:00 GMT 2006
[rmansfield@bender rmansfield]$
/home/rmansfield/crosstool/gcc-4.0-20060309-glibc-2.3.6/sh4-unknown-linux-gnu/bin/sh4-unknown-linux-gnu-gcc
-v -o t.s -S -m4 -O2 t.c
Using built-in specs.
Target: sh4-unknown-linux-gnu
Configured with:
/home/rmansfield/crosstool-0.42/build/sh4-unknown-linux-gnu/gcc-4.0-20060309-glibc-2.3.6/gcc-4.0-20060309/configure
--target=sh4-unknown-linux-gnu --host=i686-host_pc-linux-gnu
--prefix=/home/rmansfield/crosstool/gcc-4.0-20060309-glibc-2.3.6/sh4-unknown-linux-gnu
--with-multilib-list=m4,m4-nofpu
--with-headers=/home/rmansfield/crosstool/gcc-4.0-20060309-glibc-2.3.6/sh4-unknown-linux-gnu/sh4-unknown-linux-gnu/include
--with-local-prefix=/home/rmansfield/crosstool/gcc-4.0-20060309-glibc-2.3.6/sh4-unknown-linux-gnu/sh4-unknown-linux-gnu
--disable-nls --enable-threads=posix --enable-symvers=gnu --enable-__cxa_atexit
--enable-languages=c --enable-shared --enable-c99 --enable-long-long
Thread model: posix
gcc version 4.0.3
mov.l .L66,r0
mov r11,r1
mov.w .L65,r12
add #64,r1 ; use here
mov r3,r8
mov #30,r13
jsr @r0 ; call to __sdivsi3_4
nop
sts fpul,r2
add #-124,r8
mov #120,r0
add r3,r12
mov.l r0,@(8,r14)
mov #31,r7
mov.l r2,@(56,r1) ; kaboom
...
.L66:
.long __sdivsi3_i4
Then in the plt stub r1 gets clobbered.
0x804041c <_sdivsi3_i4>: mov.l 0x8040424 <_sdivsi3_i4+8>,r1 !
0x80418a0
0x804041e <_sdivsi3_i4+2>: mov.l @r1,r1
0x8040420 <_sdivsi3_i4+4>: jmp @r1
/home/rmansfield/crosstool/gcc-4.1.0-glibc-2.3.6/sh4-unknown-linux-gnu/bin/sh4-unknown-linux-gnu-gcc
-v -o t.s -S -m4 -O2 t.c
Using built-in specs.
Target: sh4-unknown-linux-gnu
Configured with:
/home/rmansfield/crosstool-0.42/build/sh4-unknown-linux-gnu/gcc-4.1.0-glibc-2.3.6/gcc-4.1.0/configure
--target=sh4-unknown-linux-gnu --host=i686-host_pc-linux-gnu
--prefix=/home/rmansfield/crosstool/gcc-4.1.0-glibc-2.3.6/sh4-unknown-linux-gnu
--with-multilib-list=m4,m4-nofpu
--with-headers=/home/rmansfield/crosstool/gcc-4.1.0-glibc-2.3.6/sh4-unknown-linux-gnu/sh4-unknown-linux-gnu/include
--with-local-prefix=/home/rmansfield/crosstool/gcc-4.1.0-glibc-2.3.6/sh4-unknown-linux-gnu/sh4-unknown-linux-gnu
--disable-nls --enable-threads=posix --enable-symvers=gnu --enable-__cxa_atexit
--enable-languages=c --enable-shared --enable-c99 --enable-long-long
Thread model: posix
gcc version 4.1.0
gcc 4.1 generates the following code:
mov.l .L57,r0
jsr @r0
nop
sts fpul,r4
.L8:
mov.w .L55,r8
mov r9,r1
mov.w .L56,r12
add #64,r1
add r10,r8
mov.l r4,@(56,r1)
...
.L57:
.long __sdivsi3_i4
I think this hasn't been previously observed because the .hidden directive in
lib1funcs.asm makes each shared library get its own private __sdivsi3_i4 that
it can call directly and no registers end up being clobbered. But shouldn't
(clobber (reg:SI R1_REG)) in
"divsi3" prevent the use of R1-R3 across the __sdivsi3 call?
--
Summary: use of r1-r3 across __sdivsi3_4 call
Product: gcc
Version: 4.0.3
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: rmansfield at qnx dot com
GCC build triplet: i686-host_pc-linux-gnu
GCC host triplet: i686-host_pc-linux-gnu
GCC target triplet: sh4-unknown-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26636
More information about the Gcc-bugs
mailing list