public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* inline-asm/10035: arm register r0 is corrupted
@ 2003-03-12 6:36 murphychen
0 siblings, 0 replies; 2+ messages in thread
From: murphychen @ 2003-03-12 6:36 UTC (permalink / raw)
To: gcc-gnats
>Number: 10035
>Category: inline-asm
>Synopsis: arm register r0 is corrupted
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Mar 12 06:36:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: gcc-3.0
>Release: unknown-1.0
>Organization:
>Environment:
linux
>Description:
When assigning local variable to use arm register r0, the initialization of the local variable will be ignored.
>How-To-Repeat:
compile the c code again.
>Fix:
Don't know how to fix.
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="gccbug.txt"
Content-Disposition: inline; filename="gccbug.txt"
$cat test.c
int fun(char *s, long n) {
register long a asm("r0");
a = 3;
fun("xxx", a);
a = 5;
return a;
}
$ arm-linux-gcc -Os -S -mthumb -mcpu=arm7tdmi -mtune=arm7tdmi -march=armv4t test.c
$ cat test.s
@ Generated by gcc 3.0 for ARM/elf
.file "test.c"
.code 16
.section .rodata
.align 2
.LC0:
.ascii "xxx\000"
.text
.align 2
.global fun
.thumb_func
.type fun,function
fun:
push {lr}
ldr r0, .L3
mov r1, r0
bl fun
mov r0, #5
pop {pc}
.L4:
.align 2
.L3:
.word .LC0
.Lfe1:
.size fun,.Lfe1-fun
.ident "GCC: (GNU) 3.0"
$ arm-linux-gcc -v -Os -S -mthumb -mcpu=arm7tdmi -mtune=arm7tdmi -march=armv4t test.c
Reading specs from /usr/local/arm/3.0/lib/gcc-lib/arm-linux/3.0/specs
Configured with: ../../src/gcc-3.0/configure --target=arm-linux --prefix=/usr/local/arm/3.0 --enable-languages=c,c++,objc,f77,java --enable-threads
Thread model: posix
gcc version 3.0
/usr/local/arm/3.0/lib/gcc-lib/arm-linux/3.0/cc1 -lang-c -v -D__GNUC__=3 -D__GNUC_MINOR__=0 -D__GNUC_PATCHLEVEL__=0 -Dunix -Dlinux -D__ELF__ -D__unix__ -D__linux__ -D__ELF__ -D__unix -D__linux -Asystem=unix -Asystem=posix -Acpu=arm -Amachine=arm -D__CHAR_UNSIGNED__ -D__OPTIMIZE_SIZE__ -D__OPTIMIZE__ -D__STDC_HOSTED__=1 -D__ARM_ARCH_4T__ -D__APCS_32__ -D__ARMEL__ -D__THUMBEL__ -D__thumb__ test.c -quiet -dumpbase test.c -mthumb -mcpu=arm7tdmi -mtune=arm7tdmi -march=armv4t -Os -version -o test.s
GNU CPP version 3.0 (cpplib) (ARM GNU/Linux with ELF)
GNU C version 3.0 (arm-linux)
compiled by GNU C version 2.95.2 20000220 (Debian GNU/Linux).
#include "..." search starts here:
#include <...> search starts here:
/usr/local/arm/3.0/lib/gcc-lib/arm-linux/3.0/include
/usr/local/arm/3.0/arm-linux/sys-include
/usr/local/arm/3.0/arm-linux/include
End of search list.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: inline-asm/10035: arm register r0 is corrupted
@ 2003-03-12 11:58 rearnsha
0 siblings, 0 replies; 2+ messages in thread
From: rearnsha @ 2003-03-12 11:58 UTC (permalink / raw)
To: gcc-bugs, gcc-prs, murphychen, nobody
Synopsis: arm register r0 is corrupted
State-Changed-From-To: open->closed
State-Changed-By: rearnsha
State-Changed-When: Wed Mar 12 11:58:05 2003
State-Changed-Why:
Register r0 is reserved by the ABI for passing arguments to functions and for returning results from those functions. You can't reserve it for your own variable. In general, you must restrict fixed register allocations to registers that don't have specific purposes in the ABI. For ARM this is the set r4-r8 (and in some circumstances you may also use r9 and r10).
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=10035
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-03-12 11:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-12 6:36 inline-asm/10035: arm register r0 is corrupted murphychen
2003-03-12 11:58 rearnsha
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).