tree-pretty-print.c (dump_generic_node, [...]): Properly print bounds.
authorRichard Kenner <kenner@vlsi1.ultra.nyu.edu>
Mon, 5 Jul 2004 15:16:10 +0000 (15:16 +0000)
committerRichard Kenner <kenner@gcc.gnu.org>
Mon, 5 Jul 2004 15:16:10 +0000 (11:16 -0400)
* tree-pretty-print.c (dump_generic_node, case ARRAY_TYPE): Properly
print bounds.

From-SVN: r84118

gcc/ChangeLog
gcc/tree-pretty-print.c

index a8e9522dbf814f9895bc3d9e350c4fd36e5bc313..bcb3ca89efd47b12d07851e81c7d9946cba8d72d 100644 (file)
@@ -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.
 
index a3649ddd2a0831b3d2b5821e14b204aa960989a8..48f8c13611e9acaaf2996f0baa9af520a9d32ddd 100644 (file)
@@ -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;
       }