From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10891 invoked by alias); 28 Jul 2010 08:37:19 -0000 Received: (qmail 10803 invoked by uid 48); 28 Jul 2010 08:37:03 -0000 Date: Wed, 28 Jul 2010 08:37:00 -0000 Message-ID: <20100728083703.10802.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug target/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/msg03045.txt.bz2 ------- Comment #6 from siarhei dot siamashka at gmail dot com 2010-07-28 08:37 ------- 'arm_size_return_regs()' returns 2 when generating epilogue for 'next' function here. And as a result, return value not registered in the mask, causing it to be clobbered. Would the following patch be the right fix? Index: gcc/config/arm/arm.c =================================================================== --- gcc/config/arm/arm.c (revision 162411) +++ gcc/config/arm/arm.c (working copy) @@ -13705,7 +13705,7 @@ && !crtl->tail_call_emit) { unsigned long mask; - mask = (1 << (arm_size_return_regs() / 4)) - 1; + mask = (1 << ((arm_size_return_regs() + 3) / 4)) - 1; mask ^= 0xf; mask &= ~saved_regs_mask; reg = 0; -- siarhei dot siamashka at gmail dot com changed: What |Removed |Added ---------------------------------------------------------------------------- Component|c++ |target http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45070