public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ryos at sinby dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/39429]  New: compiler create bad asm codes.
Date: Wed, 11 Mar 2009 07:25:00 -0000	[thread overview]
Message-ID: <bug-39429-17427@http.gcc.gnu.org/bugzilla/> (raw)

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


             reply	other threads:[~2009-03-11  7:25 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-11  7:25 ryos at sinby dot com [this message]
2009-03-12  1:19 ` [Bug c++/39429] " ryos at sinby dot com
2009-03-16 22:53 ` rearnsha at gcc dot gnu dot org
2009-03-16 23:02 ` [Bug target/39429] " rearnsha at gcc dot gnu dot org
2009-07-11 20:20 ` mikpe at it dot uu dot se
2009-07-12 11:30 ` mikpe at it dot uu dot se
2009-07-12 20:51 ` ramana at gcc dot gnu dot org
2009-07-12 21:21 ` mikpe at it dot uu dot se
2009-07-12 23:58 ` mikpe at it dot uu dot se
2009-07-13 13:06 ` mikpe at it dot uu dot se
2009-07-13 13:07 ` mikpe at it dot uu dot se

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-39429-17427@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).