Commit 8d740330 by Richard Henderson Committed by Richard Henderson

re PR middle-end/19689 (ICE in store_bit_field, at expmed.c)

        PR middle-end/19689
        * expr.c (store_field): Don't strip sub-mode cast when the input
        data is even smaller.

From-SVN: r94429
parent 486e4326
2005-01-29 Richard Henderson <rth@redhat.com> 2005-01-29 Richard Henderson <rth@redhat.com>
PR middle-end/19689
* expr.c (store_field): Don't strip sub-mode cast when the input
data is even smaller.
2005-01-29 Richard Henderson <rth@redhat.com>
PR middle-end/19687 PR middle-end/19687
* expr.c (categorize_ctor_elements_1): Check for CONSTRUCTOR of a * expr.c (categorize_ctor_elements_1): Check for CONSTRUCTOR of a
union being empty. union being empty.
......
...@@ -5226,12 +5226,18 @@ store_field (rtx target, HOST_WIDE_INT bitsize, HOST_WIDE_INT bitpos, ...@@ -5226,12 +5226,18 @@ store_field (rtx target, HOST_WIDE_INT bitsize, HOST_WIDE_INT bitpos,
the field we're storing into, that mask is redundant. This is the field we're storing into, that mask is redundant. This is
particularly common with bit field assignments generated by the particularly common with bit field assignments generated by the
C front end. */ C front end. */
if (TREE_CODE (exp) == NOP_EXPR if (TREE_CODE (exp) == NOP_EXPR)
&& INTEGRAL_TYPE_P (TREE_TYPE (exp)) {
&& (TYPE_PRECISION (TREE_TYPE (exp)) tree type = TREE_TYPE (exp);
< GET_MODE_BITSIZE (TYPE_MODE (TREE_TYPE (exp)))) if (INTEGRAL_TYPE_P (type)
&& bitsize == TYPE_PRECISION (TREE_TYPE (exp))) && TYPE_PRECISION (type) < GET_MODE_BITSIZE (TYPE_MODE (type))
&& bitsize == TYPE_PRECISION (type))
{
type = TREE_TYPE (TREE_OPERAND (exp, 0));
if (INTEGRAL_TYPE_P (type) && TYPE_PRECISION (type) >= bitsize)
exp = TREE_OPERAND (exp, 0); exp = TREE_OPERAND (exp, 0);
}
}
temp = expand_expr (exp, NULL_RTX, VOIDmode, 0); temp = expand_expr (exp, NULL_RTX, VOIDmode, 0);
......
extern void abort (void);
struct
{
int b : 29;
} f;
void foo (short j)
{
f.b = j;
}
int main()
{
foo (-55);
if (f.b != -55)
abort ();
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment