public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/24528]  New: [ARM EB] strcpy() of small string constant produces wrong instructions
@ 2005-10-25 20:49 djohnson+gcc at sw dot starentnetworks dot com
  2005-10-25 21:40 ` [Bug target/24528] " pinskia at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: djohnson+gcc at sw dot starentnetworks dot com @ 2005-10-25 20:49 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug target/24528] [ARM EB] strcpy() of small string constant produces wrong instructions
  2005-10-25 20:49 [Bug c/24528] New: [ARM EB] strcpy() of small string constant produces wrong instructions djohnson+gcc at sw dot starentnetworks dot com
@ 2005-10-25 21:40 ` pinskia at gcc dot gnu dot org
  2005-10-25 21:43 ` djohnson+gcc at sw dot starentnetworks dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-10-25 21:40 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2005-10-25 21:40 -------
Can you attach the preprocessed source for the code you have?


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
           Keywords|                            |wrong-code


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug target/24528] [ARM EB] strcpy() of small string constant produces wrong instructions
  2005-10-25 20:49 [Bug c/24528] New: [ARM EB] strcpy() of small string constant produces wrong instructions djohnson+gcc at sw dot starentnetworks dot com
  2005-10-25 21:40 ` [Bug target/24528] " pinskia at gcc dot gnu dot org
@ 2005-10-25 21:43 ` djohnson+gcc at sw dot starentnetworks dot com
  2005-10-25 22:05 ` djohnson+gcc at sw dot starentnetworks dot com
  2005-10-26 12:33 ` rearnsha at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: djohnson+gcc at sw dot starentnetworks dot com @ 2005-10-25 21:43 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from djohnson+gcc at sw dot starentnetworks dot com  2005-10-25 21:43 -------
Created an attachment (id=10057)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=10057&action=view)
preprocessed file


-- 


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug target/24528] [ARM EB] strcpy() of small string constant produces wrong instructions
  2005-10-25 20:49 [Bug c/24528] New: [ARM EB] strcpy() of small string constant produces wrong instructions djohnson+gcc at sw dot starentnetworks dot com
  2005-10-25 21:40 ` [Bug target/24528] " pinskia at gcc dot gnu dot org
  2005-10-25 21:43 ` djohnson+gcc at sw dot starentnetworks dot com
@ 2005-10-25 22:05 ` djohnson+gcc at sw dot starentnetworks dot com
  2005-10-26 12:33 ` rearnsha at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: djohnson+gcc at sw dot starentnetworks dot com @ 2005-10-25 22:05 UTC (permalink / raw)
  To: gcc-bugs



-- 

djohnson+gcc at sw dot starentnetworks dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |UNCONFIRMED


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug target/24528] [ARM EB] strcpy() of small string constant produces wrong instructions
  2005-10-25 20:49 [Bug c/24528] New: [ARM EB] strcpy() of small string constant produces wrong instructions djohnson+gcc at sw dot starentnetworks dot com
                   ` (2 preceding siblings ...)
  2005-10-25 22:05 ` djohnson+gcc at sw dot starentnetworks dot com
@ 2005-10-26 12:33 ` rearnsha at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: rearnsha at gcc dot gnu dot org @ 2005-10-26 12:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from rearnsha at gcc dot gnu dot org  2005-10-26 12:33 -------
If you can't upgrade to gcc-3.4, see the patch link in the bug this is a
duplicate of

*** This bug has been marked as a duplicate of 22528 ***


-- 

rearnsha at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-10-26 12:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-10-25 20:49 [Bug c/24528] New: [ARM EB] strcpy() of small string constant produces wrong instructions djohnson+gcc at sw dot starentnetworks dot com
2005-10-25 21:40 ` [Bug target/24528] " pinskia at gcc dot gnu dot org
2005-10-25 21:43 ` djohnson+gcc at sw dot starentnetworks dot com
2005-10-25 22:05 ` djohnson+gcc at sw dot starentnetworks dot com
2005-10-26 12:33 ` rearnsha at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).