diff options
author | Richard Henderson <rth@redhat.com> | 2005-01-26 16:07:41 -0800 |
---|---|---|
committer | Richard Henderson <rth@gcc.gnu.org> | 2005-01-26 16:07:41 -0800 |
commit | 48cc8d3b41eaf47e1a8f3eaa4c4f76c655ae4784 (patch) | |
tree | f3474ccdfed8911f1cf4ff4e40df78bca88922f7 /gcc/expr.c | |
parent | eec6bb06c65297a56eeff3c6bd8e4b31fec554bb (diff) | |
download | gcc-48cc8d3b41eaf47e1a8f3eaa4c4f76c655ae4784.zip gcc-48cc8d3b41eaf47e1a8f3eaa4c4f76c655ae4784.tar.gz gcc-48cc8d3b41eaf47e1a8f3eaa4c4f76c655ae4784.tar.bz2 |
For real this time...
PR middle-end/18008
* c-decl.c (finish_struct): Set DECL_MODE after resetting a
field's type.
* expr.c (store_field): Strip conversions to odd-bit-sized types
if the destination field width matches.
From-SVN: r94294
Diffstat (limited to 'gcc/expr.c')
-rw-r--r-- | gcc/expr.c | 16 |
1 files changed, 15 insertions, 1 deletions
@@ -5215,7 +5215,21 @@ store_field (rtx target, HOST_WIDE_INT bitsize, HOST_WIDE_INT bitpos, && TREE_CODE (TYPE_SIZE (TREE_TYPE (exp))) == INTEGER_CST && compare_tree_int (TYPE_SIZE (TREE_TYPE (exp)), bitsize) != 0)) { - rtx temp = expand_expr (exp, NULL_RTX, VOIDmode, 0); + rtx temp; + + /* If EXP is a NOP_EXPR of precision less than its mode, then that + implies a mask operation. If the precision is the same size as + the field we're storing into, that mask is redundant. This is + particularly common with bit field assignments generated by the + C front end. */ + if (TREE_CODE (exp) == NOP_EXPR + && INTEGRAL_TYPE_P (TREE_TYPE (exp)) + && (TYPE_PRECISION (TREE_TYPE (exp)) + < GET_MODE_BITSIZE (TYPE_MODE (TREE_TYPE (exp)))) + && bitsize == TYPE_PRECISION (TREE_TYPE (exp))) + exp = TREE_OPERAND (exp, 0); + + temp = expand_expr (exp, NULL_RTX, VOIDmode, 0); /* If BITSIZE is narrower than the size of the type of EXP we will be narrowing TEMP. Normally, what's wanted are the |