This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[craign@cheque.uq.edu.au: ARM GCC Bug]
- To: gcc-bugs at gcc dot gnu dot org
- Subject: [craign@cheque.uq.edu.au: ARM GCC Bug]
- From: Nick Clifton <nickc at cygnus dot com>
- Date: Wed, 19 Jan 2000 16:37:39 -0800
Forwarded bug report:
------- Start of forwarded message -------
Date: Wed, 19 Jan 2000 19:11:46 -0500 (EST)
From: "Craig Newell (W2/VK4YEQ)" <craign@cheque.uq.edu.au>
To: nickc@cygnus.com
Subject: ARM GCC Bug
Hi There,
I have been given your name by James Smith as someone I could report GCC
problems to wrt. the ARM port. If I am talking to the wrong person,
please say so (and forward this bug) on to the correct person.
Anyway, the bug report including code to reproduce it is below:
Thanks,
CraigN
- ---
Craig Newell email: CraigN@cheque.uq.edu.au
Free Spirit icbm: somewhere in NJ, USA
- -----------------------------------------------------------------------------
GCC Configuration:
source: EGCS CVS tree (19:00 EST Jan 19, 2000)
compiler target: arm-elf
compiler host: linux i386 (RedHat 6.1 plus all updates)
compiler options: arm-elf-gcc -O2 -S bug.c
Bug:
The bug is that the loop counter "c" gets decremented by 2 each loop
instead of by one.
- --- bug.c -------------------------------------
int a(int c, char **v) {
while (c--) {
if (!strcmp(*v,"a")) {
c--;
continue;
}
if (!strcmp(*v++,"b"))
return 0;
}
return 1;
}
- --- bug.S C------------------------------------
@ Generated by gcc 2.96 20000119 (experimental) for ARM/elf
.file "t.c"
.gcc2_compiled.:
.section .rodata
.align 2
.LC0:
.ascii "a\000"
.align 2
.LC1:
.ascii "b\000"
.text
.align 2
.global a
.type a,function
a:
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 1, current_function_anonymous_args = 0
mov ip, sp
stmfd sp!, {r4, r5, fp, ip, lr, pc}
sub r4, r0, #1
cmn r4, #1
sub fp, ip, #4
mov r5, r1
beq .L4
.L5:
ldr r1, .L9
sub r4, r4, #2
ldr r0, [r5, #0]
bl strcmp
cmp r0, #0
ldr r1, .L9+4
beq .L3
ldr r0, [r5], #4
bl strcmp
cmp r0, #0
ldmeqea fp, {r4, r5, fp, sp, pc}
.L3:
cmn r4, #1
bne .L5
.L4:
mov r0, #1
ldmea fp, {r4, r5, fp, sp, pc}
.L10:
.align 2
.L9:
.word .LC0
.word .LC1
.Lfe1:
.size a,.Lfe1-a
- --------------------------------------
------- End of forwarded message -------