This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Make debug_tree() print the length of a TREE_VEC


When printing a TREE_VEC, this patch makes its length get printed
alongside its prefix, e.g.

    <tree_vec 0x7ffff6a4d0a0 length 2
        elt 0 ....>

Without a reference to its length, an all-NULL TREE_VEC otherwise looks like
an empty TREE_VEC, since NULL elts don't get printed.  This makes
debugging such TREE_VECs pretty confusing.

Is this OK to commit?

gcc/ChangeLog:

	* print-tree.c (print_node) [TREE_VEC]: Print its length.
---
 gcc/print-tree.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gcc/print-tree.c b/gcc/print-tree.c
index 94b4d7d..fe6b769 100644
--- a/gcc/print-tree.c
+++ b/gcc/print-tree.c
@@ -809,6 +809,7 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
 
 	case TREE_VEC:
 	  len = TREE_VEC_LENGTH (node);
+	  fprintf (file, " length %d", len);
 	  for (i = 0; i < len; i++)
 	    if (TREE_VEC_ELT (node, i))
 	      {
-- 
2.4.4.410.g43ed522.dirty


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]