diff options
author | kenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4> | 1996-07-03 21:34:57 +0000 |
---|---|---|
committer | kenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4> | 1996-07-03 21:34:57 +0000 |
commit | 3486c3bf66bc963f1b0d1c5bab35140519dd7619 (patch) | |
tree | 3aaa13afd22e76d95ea2fc4fa9591888538ed6f9 | |
parent | 6e8b4b1dd8f8b378db827ca983f8040f53bac410 (diff) | |
download | gcc-3486c3bf66bc963f1b0d1c5bab35140519dd7619.tar.gz |
(default_conversion): Add bitfield promotions.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@12389 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/c-typeck.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index d2abd729042..9960f119552 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -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. |