public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rmansfield at qnx dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/26636]  New: use of r1-r3 across __sdivsi3_4 call
Date: Fri, 10 Mar 2006 18:16:00 -0000	[thread overview]
Message-ID: <bug-26636-11406@http.gcc.gnu.org/bugzilla/> (raw)

[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


             reply	other threads:[~2006-03-10 18:16 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-10 18:16 rmansfield at qnx dot com [this message]
2006-03-10 18:23 ` [Bug target/26636] " rmansfield at qnx dot com
2006-03-15 16:20 ` rmansfield at qnx dot com
2007-05-09 23:05 ` kkojima at gcc dot gnu dot org
2007-05-10  2:01 ` rmansfield at qnx dot com
2007-05-10  2:19 ` kkojima at gcc dot gnu dot org
2007-05-10  3:55 ` rmansfield at qnx dot com
2007-05-10  4:25 ` kkojima at gcc dot gnu dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-26636-11406@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).