This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/48090] New: gcc 4.5.2 miscompilation when building on arm


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]