public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/48090] New: gcc 4.5.2 miscompilation when building on arm
@ 2011-03-12  9:01 arnaud.patard@rtp-net.org
  2011-03-12  9:02 ` [Bug c/48090] " arnaud.patard@rtp-net.org
                   ` (18 more replies)
  0 siblings, 19 replies; 20+ messages in thread
From: arnaud.patard@rtp-net.org @ 2011-03-12  9:01 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: gcc 4.5.2 miscompilation when building on arm
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: arnaud.patard@rtp-net.org


With gcc-4.5.2, even with gcc-4.5-20110310, the following line of code gets
miscompiled (See attachment) :

size -= nblk * 512;

size and nblk are 64 bits.
gcc tries to compute -nblk. nblk is stored in r0,r1. gcc produces the following
asm code :

        rsbs    r1, r0, #0
        rsc     r2, r1, #0

So r1 gets corrupted by the rsbs insn, thus getting wrong value in r2.

I'm building the asm code with :
gcc -O2  -march=armv5t list2.i -o - -S

When I use :
gcc -O2 -fno-cse-follow-jumps  -march=armv5t list2.i -o - -S

I get :

        rsbs    r0, r0, #0
        rsc     r1, r1, #0

which is fine.


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

end of thread, other threads:[~2011-04-27 10:08 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-12  9:01 [Bug c/48090] New: gcc 4.5.2 miscompilation when building on arm arnaud.patard@rtp-net.org
2011-03-12  9:02 ` [Bug c/48090] " arnaud.patard@rtp-net.org
2011-03-12 12:03 ` mikpe at it dot uu.se
2011-03-12 12:16 ` arnaud.patard@rtp-net.org
2011-03-12 15:42 ` mikpe at it dot uu.se
2011-03-12 17:38 ` mikpe at it dot uu.se
2011-03-12 21:33 ` mikpe at it dot uu.se
2011-03-13 15:09 ` mikpe at it dot uu.se
2011-03-13 19:33 ` mikpe at it dot uu.se
2011-03-13 20:40 ` arnaud.patard@rtp-net.org
2011-03-14 10:32 ` [Bug target/48090] [4.5 Regression] " rguenth at gcc dot gnu.org
2011-04-10 10:42 ` rguenth at gcc dot gnu.org
2011-04-11 10:24 ` ramana at gcc dot gnu.org
2011-04-12 13:43 ` ramana at gcc dot gnu.org
2011-04-12 13:53 ` ramana at gcc dot gnu.org
2011-04-12 13:53 ` ramana at gcc dot gnu.org
2011-04-12 13:56 ` froydnj at codesourcery dot com
2011-04-13  7:41 ` ramana at gcc dot gnu.org
2011-04-13  7:56 ` ramana at gcc dot gnu.org
2011-04-27 10:08 ` ramana at gcc dot gnu.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).