From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19634 invoked by alias); 25 Oct 2005 20:49:05 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 19560 invoked by uid 48); 25 Oct 2005 20:48:48 -0000 Date: Tue, 25 Oct 2005 20:49:00 -0000 Subject: [Bug c/24528] New: [ARM EB] strcpy() of small string constant produces wrong instructions X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "djohnson+gcc at sw dot starentnetworks dot com" X-SW-Source: 2005-10/txt/msg03318.txt.bz2 List-Id: 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