public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: trauscher@loytec.com
To: gcc-gnats@gcc.gnu.org
Subject: target/8159: ARM/THUMB code uses sp as index register for automatic arrays
Date: Mon, 07 Oct 2002 08:06:00 -0000	[thread overview]
Message-ID: <200210071455.g97Etve24693@lexx.office.loytec.com> (raw)


>Number:         8159
>Category:       target
>Synopsis:       ARM/THUMB code uses sp as index register for automatic arrays
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Mon Oct 07 08:06:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Thomas Rauscher
>Release:        3.2
>Organization:
LOYTEC electronics GmbH
>Environment:
System: Linux lexx 2.2.19 #3 Mon Nov 5 10:25:49 CET 2001 i686 unknown
Architecture: i686

	
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: arm-rtems-elf
configured with: ./configure --target=arm-rtems-elf --prefix=/usr/local --enable-languages=c,c++ --with-newlib
>Description:
        The compiler sometimes uses "sp" as index register for 
        loading/storing automatic arrays.
        Optimization must be enabled for the problem to appear.

>How-To-Repeat:

        Edit the following file (x.c)

int f(int n)
{
  int a[1];
  return a[n];
}

        Running the compiler yields:
        arm-rtems-elf-gcc -v -c -O1 -save-temps -mthumb x.c

Reading specs from /usr/local/lib/gcc-lib/arm-rtems-elf/3.2/specs
Configured with: /tmp/arm/gcc-3.2/configure --target=arm-rtems-elf --prefix=/usr/local --enable-languages=c,c++ --with-newlib
Thread model: single
gcc version 3.2
 /usr/local/lib/gcc-lib/arm-rtems-elf/3.2/cpp0 -lang-c -v -D__GNUC__=3 -D__GNUC_MINOR__=2 -D__GNUC_PATCHLEVEL__=0 -D__GXX_ABI_VERSION=102 -D__ELF__ -D__ELF__ -D__OPTIMIZE__ -D__STDC_HOSTED__=1 -Acpu=arm -Amachine=arm -D__ARM_ARCH_4T__ -D__APCS_32__ -D__ARMEL__ -D__THUMBEL__ -D__ELF__ -D__USES_INITFINI__ -D__thumb__ x.c x.i
GNU CPP version 3.2 (cpplib) (ARM/ELF)
ignoring nonexistent directory "/usr/local/arm-rtems-elf/sys-include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/lib/gcc-lib/arm-rtems-elf/3.2/include
 /usr/local/arm-rtems-elf/include
End of search list.
 /usr/local/lib/gcc-lib/arm-rtems-elf/3.2/cc1 -fpreprocessed x.i -quiet -dumpbase x.c -mthumb -O1 -version -o x.s
GNU CPP version 3.2 (cpplib) (ARM/ELF)
GNU C version 3.2 (arm-rtems-elf)
        compiled by GNU C version 2.95.2 19991024 (release).
 /usr/local/lib/gcc-lib/arm-rtems-elf/3.2/../../../../arm-rtems-elf/bin/as -mno-fpu -o x.o x.s
x.s: Assembler messages:
x.s:12: Error: lo register required -- `ldr r0,[r0,sp]'

        The wrong assembly output is:

        .file   "x.c"
        .text
        .align  2
        .global f
        .thumb_func
        .type   f,function
f:
        sub     sp, sp, #4
        lsl     r0, r0, #2
        ldr     r0, [r0, sp]        !!!!! This instruction fails to assemble
        add     sp, sp, #4
        @ sp needed for prologue
        bx      lr
.Lfe1:
        .size   f,.Lfe1-f
        .ident  "GCC: (GNU) 3.2"

>Fix:

        None known.
>Release-Note:
>Audit-Trail:
>Unformatted:


             reply	other threads:[~2002-10-07 15:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-07  8:06 trauscher [this message]
2003-01-31 15:25 rearnsha

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=200210071455.g97Etve24693@lexx.office.loytec.com \
    --to=trauscher@loytec.com \
    --cc=gcc-gnats@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).