[Bug tree-optimization/71083] Unaligned bit-field address when predictive commoning
rguenth at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu May 12 11:00:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71083
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Conservative patch:
Index: gcc/tree-predcom.c
===================================================================
--- gcc/tree-predcom.c (revision 236159)
+++ gcc/tree-predcom.c (working copy)
@@ -1391,9 +1395,10 @@ ref_at_iteration (data_reference_p dr, i
&& DECL_BIT_FIELD (TREE_OPERAND (DR_REF (dr), 1)))
{
tree field = TREE_OPERAND (DR_REF (dr), 1);
+ tree type = build_aligned_type (DECL_BIT_FIELD_TYPE (field),
+ BITS_PER_UNIT);
return build3 (BIT_FIELD_REF, TREE_TYPE (DR_REF (dr)),
- build2 (MEM_REF, DECL_BIT_FIELD_TYPE (field),
- addr, alias_ptr),
+ build2 (MEM_REF, type, addr, alias_ptr),
DECL_SIZE (field), bitsize_zero_node);
}
else
better for archs where unaligned matters for code-gen would be to
base the ref off DECL_BIT_FIELD_REPRESENTATIVE (though that doesn't
seem to have meaningful alignment either in this case).
More information about the Gcc-bugs
mailing list