Given the following c code from sysvinit's init.c:

        if (ch->action == SYSINIT) strcpy(ch->rlevel, "#");

gcc is producing the correct set of instructions for little endian arm, but
incorrect set of instructions for big endian arm.


That line when compiled with -mlittle-endian (correct):

        ldr     r1, [r5, #40]
        cmp     r1, #13
        moveq   r3, #35
        moveq   r2, #0
        streqb  r3, [r5, #28]
        streqb  r2, [r5, #29]

That line when compiled with -mbig-endian (wrong):

        ldr     r1, [r5, #40]
        cmp     r1, #13
        moveq   r3, #0
        streqb  r3, [r5, #29]
        streqb  r3, [r5, #28]

This results in ch->rlevel[0] set to zero instead of '#'.

Offsets/enums are correct (40 for action, 28 for start of rlevel, and 13 for
SYSINIT).

I can post entire preprocessed and compiled output if needed.


compile line is:

arm-linux-gcc -c -mlong-calls -fPIC -mbig-endian -Wall -O2 -D_GNU_SOURCE init.c 

gcc version 3.3.6


-- 
           Summary: [ARM EB] strcpy() of small string constant produces
                    wrong instructions
           Product: gcc
           Version: 3.3.6
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: djohnson+gcc at sw dot starentnetworks dot com
 GCC build triplet: i686-linux
  GCC host triplet: i686-linux
GCC target triplet: arm-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24528

Reply via email to