help?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



gcc-help-help,hi!

I am using gcc-2.95.3 form ARM.

i have a c program file as follow: 

void foo1 ()
{
  int j[]={1,2};
}

void foo2 ()
{
  int j[]={1,2,3};
}


but the code generated for foo1 are:
foo1:
        @ args = 0, pretend = 0, frame = 8
        @ frame_needed = 1, current_function_anonymous_args = 0
        mov     ip, sp
        stmfd   sp!, {r4, fp, ip, lr, pc}
        sub     fp, ip, #4
        sub     sp, sp, #8
        sub     r3, fp, #24
        ldr     r2, .L4
        ldmia   r2, {r3-r4}
        sub     r1, fp, #16
        stmdb   r1, {r3-r4}
        b       .L3

and the code generated for foo2 are:
foo2:
        @ args = 0, pretend = 0, frame = 12
        @ frame_needed = 1, current_function_anonymous_args = 0
        mov     ip, sp
        stmfd   sp!, {fp, ip, lr, pc}
        sub     fp, ip, #4
        sub     sp, sp, #12
        sub     r3, fp, #24
        ldr     r2, .L8
        sub     r3, fp, #24		@**************************it is the redundant instruction, the same as above two.
        mov     ip, r2
        ldmia   ip, {r0-r2}     @ load multiple
        stmia   r3, {r0-r2}     @ str multiple
        b       .L7
  

my question is that in function foo2 there is a redundant instruction (sub     r3, fp, #24),
i donot think it's needed, whereas, there hasnot this instruction in function foo1.
why compiler generate it ?

thanks!

 				
              Shen Hui
              shenhui@xxxxxxxxxxxxxxx
                 2003-07-12

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux