This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/53438] [4.7/4.8 Regression] Bitfield store replaced with full-byte store
- From: "rguenth at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 22 May 2012 11:07:15 +0000
- Subject: [Bug tree-optimization/53438] [4.7/4.8 Regression] Bitfield store replaced with full-byte store
- Auto-submitted: auto-generated
- References: <bug-53438-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53438
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
AssignedTo|unassigned at gcc dot |rguenth at gcc dot gnu.org
|gnu.org |
--- Comment #6 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-05-22 11:07:15 UTC ---
I think the following should fix it:
Index: gcc/tree-sra.c
===================================================================
--- gcc/tree-sra.c (revision 187767)
+++ gcc/tree-sra.c (working copy)
@@ -1001,9 +1001,10 @@ build_access_from_expr_1 (tree expr, gim
@@ -2096,9 +2097,12 @@ analyze_access_subtree (struct access *r
&& (TREE_CODE (root->type) != INTEGER_TYPE
|| TYPE_PRECISION (root->type) != root->size)
/* But leave bitfield accesses alone. */
- && (root->offset % BITS_PER_UNIT) == 0)
+ && (TREE_CODE (root->expr) != COMPONENT_REF
+ || !DECL_BIT_FIELD (TREE_OPERAND (root->expr, 1))))
{
tree rt = root->type;
+ gcc_assert ((root->offset % BITS_PER_UNIT) == 0
+ && (root->size % BITS_PER_UNIT) == 0);
root->type = build_nonstandard_integer_type (root->size,
TYPE_UNSIGNED (rt));
root->expr = build_ref_for_offset (UNKNOWN_LOCATION,
can you verify that, thus give it a bootstrap & regtest run?