inline-asm/10035: arm register r0 is corrupted
murphychen@mail2000.com.tw
murphychen@mail2000.com.tw
Wed Mar 12 09:34:00 GMT 2003
>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.
More information about the Gcc-bugs
mailing list