From patchwork Sun Jun 16 19:08:12 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sandra Loosemore X-Patchwork-Id: 251735 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]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id D9BA72C00A2 for ; Mon, 17 Jun 2013 05:08:40 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:content-type; q= dns; s=default; b=sRjlt989io/KVg4rc1SmVRx/UdqeunsuCDOPuRHsfSw27I ek3+uj+sT+NU2h8e485f+9rD0MR1QDoRqxpk6UhD5uNstw3PyQalhLHc7IbHAgfN TfVhsAdcATtzb6yW7oMAj/Lbsg4ZzL1Lt8oIOUsgMXpcLSLPjVOWzfTTNVZN4= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:content-type; s= default; bh=GOo7zG5rMbule9ns17z3tiAcwfg=; b=eKNf54ohqNNcnycIHcUC n2splDDtlZhhPkqSJEosrcxo8UDVPQIHAdPzyy/+xquNngLJ7I1gDj5I3PB3k7LG DGeEXcXvPGSibK5rHuvEVjEdo9R1r9BxTHSLAENcrMjlc60HF8PBC5BfxWFuvmN3 rslcvjlMdi3wOOcMzv8fYBU= Received: (qmail 22920 invoked by alias); 16 Jun 2013 19:08:34 -0000 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 Received: (qmail 22906 invoked by uid 89); 16 Jun 2013 19:08:34 -0000 X-Spam-SWARE-Status: No, score=-3.4 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_HOSTKARMA_W, RCVD_IN_HOSTKARMA_WL autolearn=ham version=3.3.1 Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Sun, 16 Jun 2013 19:08:33 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1UoIJU-0005Mp-1f from Sandra_Loosemore@mentor.com ; Sun, 16 Jun 2013 12:08:32 -0700 Received: from SVR-ORW-FEM-03.mgc.mentorg.com ([147.34.97.39]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Sun, 16 Jun 2013 12:08:31 -0700 Received: from [IPv6:::1] (147.34.91.1) by svr-orw-fem-03.mgc.mentorg.com (147.34.97.39) with Microsoft SMTP Server id 14.2.247.3; Sun, 16 Jun 2013 12:08:01 -0700 Message-ID: <51BE0D1C.9070404@codesourcery.com> Date: Sun, 16 Jun 2013 13:08:12 -0600 From: Sandra Loosemore User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130329 Thunderbird/17.0.5 MIME-Version: 1.0 To: GCC Patches , Richard Biener Subject: [patch 3/5] don't restrict bit range for -fstrict-volatile-bitfields X-Virus-Found: No This patch fixes the PR23623 regression. In conjunction with part 2 of the series, it also fixes the new volatile-bitfields-3.c test case. As I noted in previous discussion, there might be a better place to accomplish this effect, but hacking DECL_BIT_FIELD_REPRESENTATIVE can't work because the volatile-ness may be coming from a qualifier on the pointer or object from which the field is being extracted, rather than from a volatile qualifier on the bit field decl. I think the choices are to do it in get_bit_range (as in this patch), in the callers of get_bit_range, or at the places where the bit range information is being used. -Sandra Index: gcc/expr.c =================================================================== --- gcc/expr.c (revision 199963) +++ gcc/expr.c (working copy) @@ -4508,6 +4508,16 @@ get_bit_range (unsigned HOST_WIDE_INT *b gcc_assert (TREE_CODE (exp) == COMPONENT_REF); + /* If -fstrict-volatile-bitfields was given and this is a volatile + access, then we must ignore any DECL_BIT_FIELD_REPRESENTATIVE and + do the access in the mode of the field. */ + if (TREE_THIS_VOLATILE (exp) + && flag_strict_volatile_bitfields > 0) + { + *bitstart = *bitend = 0; + return; + } + field = TREE_OPERAND (exp, 1); repr = DECL_BIT_FIELD_REPRESENTATIVE (field); /* If we do not have a DECL_BIT_FIELD_REPRESENTATIVE there is no