From patchwork Tue Dec 27 02:19:55 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joey Ye X-Patchwork-Id: 133293 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 18F95B6F68 for ; Tue, 27 Dec 2011 13:20:21 +1100 (EST) Received: (qmail 9380 invoked by alias); 27 Dec 2011 02:20:16 -0000 Received: (qmail 9346 invoked by uid 22791); 27 Dec 2011 02:20:13 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-ww0-f51.google.com (HELO mail-ww0-f51.google.com) (74.125.82.51) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 27 Dec 2011 02:19:59 +0000 Received: by wgbdr1 with SMTP id dr1so18097495wgb.8 for ; Mon, 26 Dec 2011 18:19:57 -0800 (PST) MIME-Version: 1.0 Received: by 10.227.60.4 with SMTP id n4mr25712386wbh.9.1324952395798; Mon, 26 Dec 2011 18:19:55 -0800 (PST) Received: by 10.227.201.145 with HTTP; Mon, 26 Dec 2011 18:19:55 -0800 (PST) Date: Tue, 27 Dec 2011 10:19:55 +0800 Message-ID: Subject: [patch] [4.6] Backport strict-volatile-bitfields fix PR51200 From: Ye Joey To: gcc-patches X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Fix PR51200. Backport trunk 182545, 182649, 182685 to 4.6. OK to 4.6? - Joey 2011-12-20 Bernd Schmidt PR middle-end/51200 * expr.c (store_field): Avoid a direct store if the mode is larger than the size of the bit field. * stor-layout.c (layout_decl): If flag_strict_volatile_bitfields, treat non-volatile bit fields like volatile ones. * toplev.c (process_options): Disallow combination of -fstrict-volatile-bitfields and ABI versions less than 2. * config/arm/arm.c (arm_option_override): Don't enable flag_strict_volatile_bitfields if the ABI version is less than 2. * config/h8300/h8300.c (h8300_option_override): Likewise. * config/rx/rx.c (rx_option_override): Likewise. * config/m32c/m32c.c (m32c_option_override): Likewise. * config/sh/sh.c (sh_option_override): Likewise. 2011-12-22 Joey Ye * toplev.c (process_options): Fix typo. testsute 2011-12-20 Bernd Schmidt PR middle-end/51200 * gcc.target/arm/volatile-bitfields-4.c: New test. * c-c++-common/abi-bf.c: New test. 2011-12-26 Joey Ye PR middle-end/51200 * gcc.dg/volatile-bitfields-2.c: New test. Index: gcc/testsuite/gcc.dg/volatile-bitfields-2.c =================================================================== --- gcc/testsuite/gcc.dg/volatile-bitfields-2.c (revision 0) +++ gcc/testsuite/gcc.dg/volatile-bitfields-2.c (revision 182685) @@ -0,0 +1,15 @@ +/* { dg-do run } */ +/* { dg-options "-fstrict-volatile-bitfields" } */ + +extern void abort(void); +struct thing { + volatile unsigned short a: 8; + volatile unsigned short b: 8; +} t = {1,2}; + +int main() +{ + t.a = 3; + if (t.a !=3 || t.b !=2) abort(); + return 0; +} Index: gcc/testsuite/ChangeLog =================================================================== --- gcc/testsuite/ChangeLog (revision 182684) +++ gcc/testsuite/ChangeLog (revision 182685) @@ -1,3 +1,8 @@ +2011-12-26 Joey Ye + + PR middle-end/51200 + * gcc.dg/volatile-bitfields-2.c: New test. + 2011-12-23 Jason Merrill PR c++/51507