This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/39429] New: compiler create bad asm codes.
- From: "ryos at sinby dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 11 Mar 2009 07:24:44 -0000
- Subject: [Bug c++/39429] New: compiler create bad asm codes.
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
the Compiler creates bad asm codes from following source.
bool
ArmGccTest::useOffScreen()
{
if ((mapsize - size) < 16*1024)
return false;
return true;
}
.text
.align 2
.global _ZN10ArmGccTest12useOffScreenEv
.type _ZN10ArmGccTest12useOffScreenEv, %function
_ZN10ArmGccTest12useOffScreenEv:
.fnstart
.LFB2:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
@ link register save eliminated.
ldr r0, [r0, #1080]
ldr r3, [r0, #1084]
sub r0, r0, r3
cmp r0, #16384
movcc r0, #0
movcs r0, #1
bx lr
r0 is assigned for "this". however r0 is rewritten to use "mapsize", so r3 is
broken. You can see this problem by following simple c++ source.
class ArmGccTest {
private:
unsigned int value001;
....
....
....
unsigned int value109;
unsigned int value10a;
unsigned int value10b;
unsigned int value10c;
unsigned int value10d;
unsigned int mapsize;
unsigned int size;
unsigned int value10e;
bool useOffScreen();
};
--
Summary: compiler create bad asm codes.
Product: gcc
Version: 4.3.3
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ryos at sinby dot com
GCC host triplet: arm-linux, i386-linux, i386-freebsd
GCC target triplet: arm-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39429