aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2003-10-21 22:19:38 -0400
committerJason Merrill <jason@gcc.gnu.org>2003-10-21 22:19:38 -0400
commite64a6f2c6e98cc42276be79a712900da33811a36 (patch)
tree68c8eeaf391327dbbc42d1b6c2f6b76135688242 /gcc/tree.c
parent40aae1784298218b225bfe9a237496a0e77acbed (diff)
downloadgcc-e64a6f2c6e98cc42276be79a712900da33811a36.zip
gcc-e64a6f2c6e98cc42276be79a712900da33811a36.tar.gz
gcc-e64a6f2c6e98cc42276be79a712900da33811a36.tar.bz2
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
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index dd8378e..7d0258c 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -4105,7 +4105,8 @@ get_unwidened (tree op, tree for_type)
{
unsigned int innerprec
= 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);
/* We can get this structure field in the narrowest type it fits in.
@@ -4189,8 +4190,9 @@ get_narrower (tree op, int *unsignedp_ptr)
{
unsigned HOST_WIDE_INT innerprec
= tree_low_cst (DECL_SIZE (TREE_OPERAND (op, 1)), 1);
- tree type = (*lang_hooks.types.type_for_size) (innerprec,
- TREE_UNSIGNED (op));
+ int unsignedp = (TREE_UNSIGNED (TREE_OPERAND (op, 1))
+ || 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,
but the resulting extension to its nominal type (a fullword type)