Commit 2709efd8 by Richard Kenner Committed by Richard Kenner

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
parent ebd5a208
...@@ -5,6 +5,9 @@ ...@@ -5,6 +5,9 @@
2004-07-05 Richard Kenner <kenner@vlsi1.ultra.nyu.edu> 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 * expr.c (expand_expr_real_1, case SWITCH_EXPR): Don't check against
bounds if bounds aren't constant. bounds if bounds aren't constant.
......
...@@ -378,27 +378,37 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags, ...@@ -378,27 +378,37 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags,
{ {
tree tmp; tree tmp;
/* Print the array type. */ /* Print the innermost component type. */
dump_generic_node (buffer, TREE_TYPE (node), spc, flags, false); 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. */ /* Print the dimensions. */
tmp = node; for (tmp = node; TREE_CODE (tmp) == ARRAY_TYPE;
while (tmp && TREE_CODE (tmp) == ARRAY_TYPE) tmp = TREE_TYPE (tmp))
{ {
tree domain = TYPE_DOMAIN (tmp);
pp_character (buffer, '['); pp_character (buffer, '[');
if (TYPE_SIZE (tmp)) if (domain)
{ {
tree size = TYPE_SIZE (tmp); if (TYPE_MIN_VALUE (domain)
if (TREE_CODE (size) == INTEGER_CST) && !integer_zerop (TYPE_MIN_VALUE (domain)))
pp_wide_integer (buffer, {
TREE_INT_CST_LOW (TYPE_SIZE (tmp)) / dump_generic_node (buffer, TYPE_MIN_VALUE (domain),
TREE_INT_CST_LOW (TYPE_SIZE (TREE_TYPE (tmp)))); spc, flags, false);
else if (TREE_CODE (size) == MULT_EXPR) pp_string (buffer, " .. ");
dump_generic_node (buffer, TREE_OPERAND (size, 0), spc, flags, false); }
/* else punt. */
if (TYPE_MAX_VALUE (domain))
dump_generic_node (buffer, TYPE_MAX_VALUE (domain),
spc, flags, false);
} }
else
pp_string (buffer, "<unknown>");
pp_character (buffer, ']'); pp_character (buffer, ']');
tmp = TREE_TYPE (tmp);
} }
break; break;
} }
......
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