public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "siarhei dot siamashka at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/45070] Miscompiled c++ class with packed attribute on ARM with -Os optimizations (Qt 4.6.2)
Date: Wed, 28 Jul 2010 07:16:00 -0000	[thread overview]
Message-ID: <20100728071606.22530.qmail@sourceware.org> (raw)
In-Reply-To: <bug-45070-14457@http.gcc.gnu.org/bugzilla/>



------- Comment #4 from siarhei dot siamashka at gmail dot com  2010-07-28 07:16 -------
Could not reproduce the problem with gcc 4.3.5

Disassembly of pr45070.o:

0000000c <next>:
   c:   e92d401f        push    {r0, r1, r2, r3, r4, lr}
  10:   e890000c        ldm     r0, {r2, r3}
  14:   e1a04000        mov     r4, r0
  18:   e1520003        cmp     r2, r3
  1c:   b3a03000        movlt   r3, #0
  20:   ba000014        blt     78 <next+0x6c>
  24:   e5903008        ldr     r3, [r0, #8]
  28:   e3530000        cmp     r3, #0
  2c:   0a00000e        beq     6c <next+0x60>
  30:   e3a03000        mov     r3, #0
  34:   e5803008        str     r3, [r0, #8]
  38:   e2800004        add     r0, r0, #4
  3c:   ebffffef        bl      0 <fetch>
  40:   e1a00004        mov     r0, r4
  44:   ebfffff0        bl      c <next>
  48:   e1a00800        lsl     r0, r0, #16
  4c:   e1a00840        asr     r0, r0, #16
  50:   e5cd0000        strb    r0, [sp]
  54:   e1a00420        lsr     r0, r0, #8
  58:   e5cd0001        strb    r0, [sp, #1]
  5c:   e1dd30b0        ldrh    r3, [sp]
  60:   e1cd30bc        strh    r3, [sp, #12]
  64:   e1dd30bc        ldrh    r3, [sp, #12]
  68:   ea000002        b       78 <next+0x6c>
  6c:   e3a03001        mov     r3, #1
  70:   e5803008        str     r3, [r0, #8]
  74:   e59f3010        ldr     r3, [pc, #16]   ; 8c <next+0x80>
  78:   e1cd30bc        strh    r3, [sp, #12]
  7c:   e5dd300c        ldrb    r3, [sp, #12]
  80:   e5dd000d        ldrb    r0, [sp, #13]
  84:   e1830400        orr     r0, r3, r0, lsl #8
  88:   e8bd801f        pop     {r0, r1, r2, r3, r4, pc}

^^^ POP instruction just overwrites return value in r0 register here

  8c:   0000ffff        .word   0x0000ffff

Looks like the function gets treated as if it were returning 'void'.


-- 

siarhei dot siamashka at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
      Known to fail|                            |4.5.0
      Known to work|                            |4.3.5


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


  parent reply	other threads:[~2010-07-28  7:16 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-25 23:23 [Bug c++/45070] New: " siarhei dot siamashka at gmail dot com
2010-07-25 23:25 ` [Bug c++/45070] " siarhei dot siamashka at gmail dot com
2010-07-26  8:49 ` mikpe at it dot uu dot se
2010-07-26  9:33 ` mikpe at it dot uu dot se
2010-07-28  7:16 ` siarhei dot siamashka at gmail dot com [this message]
2010-07-28  7:18 ` siarhei dot siamashka at gmail dot com
2010-07-28  8:37 ` [Bug target/45070] " siarhei dot siamashka at gmail dot com
2010-07-28  9:01 ` ramana at gcc dot gnu dot org
2010-07-28  9:22 ` ramana at gcc dot gnu dot org
2010-07-28  9:35 ` rearnsha at gcc dot gnu dot org
2010-07-28  9:46 ` mikpe at it dot uu dot se
2010-08-03 17:13 ` ian dot bolton at arm dot com
2010-08-14 15:33 ` armin76 at gentoo dot org
2010-08-14 16:28 ` siarhei dot siamashka at gmail dot com
2010-08-19  8:28 ` ramana at gcc dot gnu dot org
2010-09-02 13:06 ` ibolton at gcc dot gnu dot org
2010-09-04 16:42 ` armin76 at gentoo dot org
2010-09-07  9:26 ` ibolton at gcc dot gnu dot org
2010-09-07 11:08 ` ibolton at gcc dot gnu dot org
2010-09-14 14:06 ` rearnsha at gcc dot gnu dot org

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=20100728071606.22530.qmail@sourceware.org \
    --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).