From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22633 invoked by alias); 28 Jul 2010 07:16:29 -0000 Received: (qmail 22531 invoked by uid 48); 28 Jul 2010 07:16:06 -0000 Date: Wed, 28 Jul 2010 07:16:00 -0000 Message-ID: <20100728071606.22530.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug c++/45070] Miscompiled c++ class with packed attribute on ARM with -Os optimizations (Qt 4.6.2) In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "siarhei dot siamashka at gmail dot com" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2010-07/txt/msg03028.txt.bz2 ------- 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 : 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 24: e5903008 ldr r3, [r0, #8] 28: e3530000 cmp r3, #0 2c: 0a00000e beq 6c 30: e3a03000 mov r3, #0 34: e5803008 str r3, [r0, #8] 38: e2800004 add r0, r0, #4 3c: ebffffef bl 0 40: e1a00004 mov r0, r4 44: ebfffff0 bl c 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 6c: e3a03001 mov r3, #1 70: e5803008 str r3, [r0, #8] 74: e59f3010 ldr r3, [pc, #16] ; 8c 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