aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Kenner <kenner@vlsi1.ultra.nyu.edu>2004-07-05 15:16:10 +0000
committerRichard Kenner <kenner@gcc.gnu.org>2004-07-05 11:16:10 -0400
commit2709efd88c169398f2d23305813f6c7f3c3b18f0 (patch)
treee633c0c3816f8e0ea732d6167dcc622a1965f33e /gcc
parentebd5a2087cf3c7e1d2f8d005ef6a1d14c7cdc6e1 (diff)
downloadgcc-2709efd88c169398f2d23305813f6c7f3c3b18f0.zip
gcc-2709efd88c169398f2d23305813f6c7f3c3b18f0.tar.gz
gcc-2709efd88c169398f2d23305813f6c7f3c3b18f0.tar.bz2
tree-pretty-print.c (dump_generic_node, [...]): Properly print bounds.
* tree-pretty-print.c (dump_generic_node, case ARRAY_TYPE): Properly print bounds. From-SVN: r84118
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog3
-rw-r--r--gcc/tree-pretty-print.c38
2 files changed, 27 insertions, 14 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index a8e9522..bcb3ca8 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -5,6 +5,9 @@
2004-07-05 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
+ * tree-pretty-print.c (dump_generic_node, case ARRAY_TYPE): Properly
+ print bounds.
+
* expr.c (expand_expr_real_1, case SWITCH_EXPR): Don't check against
bounds if bounds aren't constant.
diff --git a/gcc/tree-pretty-print.c b/gcc/tree-pretty-print.c
index a3649dd..48f8c13 100644
--- a/gcc/tree-pretty-print.c
+++ b/gcc/tree-pretty-print.c
@@ -378,27 +378,37 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
{
tree tmp;
- /* Print the array type. */
- dump_generic_node (buffer, TREE_TYPE (node), spc, flags, false);
+ /* Print the innermost component type. */
+ for (tmp = TREE_TYPE (node); TREE_CODE (tmp) == ARRAY_TYPE;
+ tmp = TREE_TYPE (tmp))
+ ;
+ dump_generic_node (buffer, tmp, spc, flags, false);
/* Print the dimensions. */
- tmp = node;
- while (tmp && TREE_CODE (tmp) == ARRAY_TYPE)
+ for (tmp = node; TREE_CODE (tmp) == ARRAY_TYPE;
+ tmp = TREE_TYPE (tmp))
{
+ tree domain = TYPE_DOMAIN (tmp);
+
pp_character (buffer, '[');
- if (TYPE_SIZE (tmp))
+ if (domain)
{
- tree size = TYPE_SIZE (tmp);
- if (TREE_CODE (size) == INTEGER_CST)
- pp_wide_integer (buffer,
- TREE_INT_CST_LOW (TYPE_SIZE (tmp)) /
- TREE_INT_CST_LOW (TYPE_SIZE (TREE_TYPE (tmp))));
- else if (TREE_CODE (size) == MULT_EXPR)
- dump_generic_node (buffer, TREE_OPERAND (size, 0), spc, flags, false);
- /* else punt. */
+ if (TYPE_MIN_VALUE (domain)
+ && !integer_zerop (TYPE_MIN_VALUE (domain)))
+ {
+ dump_generic_node (buffer, TYPE_MIN_VALUE (domain),
+ spc, flags, false);
+ pp_string (buffer, " .. ");
+ }
+
+ if (TYPE_MAX_VALUE (domain))
+ dump_generic_node (buffer, TYPE_MAX_VALUE (domain),
+ spc, flags, false);
}
+ else
+ pp_string (buffer, "<unknown>");
+
pp_character (buffer, ']');
- tmp = TREE_TYPE (tmp);
}
break;
}