summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>2002-01-22 12:01:54 +0000
committerkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>2002-01-22 12:01:54 +0000
commit9b388acadf4851092642bcc4f826f8710065c974 (patch)
treed0b4885e9a5770fecec22272ef14c5026f470e13 /gcc
parentdff29840073999137197b50c24f82a364d3cdb95 (diff)
downloadgcc-9b388acadf4851092642bcc4f826f8710065c974.tar.gz
* tree.c (int_fits_type_p): If bounds of a subtype are variable, see
if fits in bounds of base type. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@49070 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog3
-rw-r--r--gcc/tree.c5
2 files changed, 7 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 0f91fb5e17d..fb10f397a6e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,8 @@
Tue Jan 22 06:26:33 2002 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
+ * tree.c (int_fits_type_p): If bounds of a subtype are variable, see
+ if fits in bounds of base type.
+
* dwarf2out.c (equate_decl_number_to_die): Add "int" to decls.
(loc_descriptor_from_tree, case CALL_EXPR, case ADDR_EXPR): New.
(add_bound_info, default): If can't find a context, make a
diff --git a/gcc/tree.c b/gcc/tree.c
index 61252e7b70e..53d5889bbbd 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -4245,7 +4245,8 @@ int_fits_type_p (c, type)
tree c, type;
{
/* If the bounds of the type are integers, we can check ourselves.
- Otherwise,. use force_fit_type, which checks against the precision. */
+ If not, but this type is a subtype, try checking against that.
+ Otherwise, use force_fit_type, which checks against the precision. */
if (TYPE_MAX_VALUE (type) != NULL_TREE
&& TYPE_MIN_VALUE (type) != NULL_TREE
&& TREE_CODE (TYPE_MAX_VALUE (type)) == INTEGER_CST
@@ -4264,6 +4265,8 @@ int_fits_type_p (c, type)
&& ! (TREE_INT_CST_HIGH (c) < 0
&& TREE_UNSIGNED (TREE_TYPE (c))));
}
+ else if (TREE_CODE (type) == INTEGER_TYPE && TREE_TYPE (type) != 0)
+ return int_fits_type_p (c, TREE_TYPE (type));
else
{
c = copy_node (c);