(default_conversion): Add bitfield promotions.
From-SVN: r12389
This commit is contained in:
parent
4689ad58a1
commit
9753f11368
1 changed files with 18 additions and 0 deletions
|
@ -1010,6 +1010,24 @@ default_conversion (exp)
|
|||
return convert (type, exp);
|
||||
}
|
||||
|
||||
if (TREE_CODE (exp) == COMPONENT_REF
|
||||
&& DECL_BIT_FIELD (TREE_OPERAND (exp, 1)))
|
||||
{
|
||||
tree width = DECL_SIZE (TREE_OPERAND (exp, 1));
|
||||
HOST_WIDE_INT low = TREE_INT_CST_LOW (width);
|
||||
|
||||
/* If it's thinner than an int, promote it like a
|
||||
C_PROMOTING_INTEGER_TYPE_P, otherwise leave it alone. */
|
||||
|
||||
if (low < TYPE_PRECISION (integer_type_node))
|
||||
{
|
||||
if ( flag_traditional && TREE_UNSIGNED (type))
|
||||
return convert (unsigned_type_node, exp);
|
||||
else
|
||||
return convert (integer_type_node, exp);
|
||||
}
|
||||
}
|
||||
|
||||
if (C_PROMOTING_INTEGER_TYPE_P (type))
|
||||
{
|
||||
/* Traditionally, unsignedness is preserved in default promotions.
|
||||
|
|
Loading…
Add table
Reference in a new issue