Commit e64a6f2c by Jason Merrill Committed by Jason Merrill

tree.c (get_unwidened): Check TREE_UNSIGNED on the field's type.

        * tree.c (get_unwidened): Check TREE_UNSIGNED on the field's type.
        (get_narrower): Likewise.

From-SVN: r72787
parent 40aae178
2003-10-21 Jason Merrill <jason@redhat.com> 2003-10-21 Jason Merrill <jason@redhat.com>
* tree.c (get_unwidened): Check TREE_UNSIGNED on the field's type.
(get_narrower): Likewise.
* stor-layout.c (layout_decl): Do packed field alignment for * stor-layout.c (layout_decl): Do packed field alignment for
bit-fields, too. bit-fields, too.
......
...@@ -4105,7 +4105,8 @@ get_unwidened (tree op, tree for_type) ...@@ -4105,7 +4105,8 @@ get_unwidened (tree op, tree for_type)
{ {
unsigned int innerprec unsigned int innerprec
= tree_low_cst (DECL_SIZE (TREE_OPERAND (op, 1)), 1); = tree_low_cst (DECL_SIZE (TREE_OPERAND (op, 1)), 1);
int unsignedp = TREE_UNSIGNED (TREE_OPERAND (op, 1)); int unsignedp = (TREE_UNSIGNED (TREE_OPERAND (op, 1))
|| TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (op, 1))));
type = (*lang_hooks.types.type_for_size) (innerprec, unsignedp); type = (*lang_hooks.types.type_for_size) (innerprec, unsignedp);
/* We can get this structure field in the narrowest type it fits in. /* We can get this structure field in the narrowest type it fits in.
...@@ -4189,8 +4190,9 @@ get_narrower (tree op, int *unsignedp_ptr) ...@@ -4189,8 +4190,9 @@ get_narrower (tree op, int *unsignedp_ptr)
{ {
unsigned HOST_WIDE_INT innerprec unsigned HOST_WIDE_INT innerprec
= tree_low_cst (DECL_SIZE (TREE_OPERAND (op, 1)), 1); = tree_low_cst (DECL_SIZE (TREE_OPERAND (op, 1)), 1);
tree type = (*lang_hooks.types.type_for_size) (innerprec, int unsignedp = (TREE_UNSIGNED (TREE_OPERAND (op, 1))
TREE_UNSIGNED (op)); || TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (op, 1))));
tree type = (*lang_hooks.types.type_for_size) (innerprec, unsignedp);
/* We can get this structure field in a narrower type that fits it, /* We can get this structure field in a narrower type that fits it,
but the resulting extension to its nominal type (a fullword type) but the resulting extension to its nominal type (a fullword type)
......
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