This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
ARM: testsuite gcc.c-torture/execute/20020307-2.c failure
- From: jeroen dobbelaere <jeroen dot dobbelaere at acunia dot com>
- To: gcc at gcc dot gnu dot org
- Date: Tue, 12 Nov 2002 14:20:29 +0100
- Subject: ARM: testsuite gcc.c-torture/execute/20020307-2.c failure
- Organization: ACUNIA
Looking at testcase
gcc.c-torture/execute/20020307-2.c
It seems that there is a problem with putting the arguments in the right place.
Following peace of code
void foo3()
{
#ifdef USE_DEFINE
# define zzz 2
#else
int zzz=2;
#endif
struct {
int a[zzz];
} t;
t.a[0]=1;
t.a[1]=2;
foo4(t);
}
results, depending on the definition of 'USE_DEFINE' in completely different output :
- for structures with a fixed array length, we get following (correct) code : (-O2)
foo3:
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
str lr, [sp, #-4]!
adr r0, .L25
ldmia r0, {r0-r1}
@ Sibcall epilogue
ldr lr, [sp], #4
b foo4
.L26:
.align 2
.L25:
.word 1
.word 2
- for structures with a variable array length, we get following (incorrect) code :
.size foo,.Lfe2-foo
.global memcpy
.align 2
.global foo3
.type foo3,function
foo3:
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 1, uses_anonymous_args = 0
mov ip, sp
stmfd sp!, {r4, r5, fp, ip, lr, pc}
mov r3, #1
mov r5, sp
mov r2, #2
sub sp, sp, #8
str r3, [sp, #0]
str r2, [sp, #4]
mov r4, sp
sub sp, sp, #8
mov r0, sp
sub fp, ip, #4
mov r2, r2, asl r2
mov r1, r4
bl memcpy
bl foo4
mov sp, r4
mov sp, r5
ldmea fp, {r4, r5, fp, sp, pc}
Between the 'bl memcpy' and 'bl foo4' there is no loading of r0-r1...
(in the case of 20020307-2 : this results in no loading of r1-r3, while the
target function expects to see data in those registers...)
Any idea where this different behavior is triggered ?
Greetings,
--
Jeroen Dobbelaere
Embedded Software Engineer
ACUNIA Embedded Solutions
http://www.acunia.com/aes