From 1a62528312e1af15fc74a8507a61aa500d118fc7 Mon Sep 17 00:00:00 2001 From: Jim Wilson Date: Thu, 4 May 1995 11:14:53 -0700 Subject: [PATCH] (plain_type): Pass additional argument to plain_type_1. (plain_type_1): New parameter level. Increment it when making recursive calls. Force the type to void_type_mode before starting a 7th level of recursion. From-SVN: r9572 --- gcc/sdbout.c | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/gcc/sdbout.c b/gcc/sdbout.c index 07bbcc6ebc7..b08a6ebb449 100644 --- a/gcc/sdbout.c +++ b/gcc/sdbout.c @@ -369,7 +369,7 @@ static int plain_type (type) tree type; { - int val = plain_type_1 (type); + int val = plain_type_1 (type, 0); /* If we have already saved up some array dimensions, print them now. */ if (sdb_n_dims > 0) @@ -449,15 +449,25 @@ sdbout_record_type_name (type) #endif } +/* Return the .type value for type TYPE. + + LEVEL indicates how many levels deep we have recursed into the type. + The SDB debug format can only represent 6 derived levels of types. + After that, we must output inaccurate debug info. We deliberately + stop before the 7th level, so that ADA recursive types will not give an + infinite loop. */ + static int -plain_type_1 (type) +plain_type_1 (type, level) tree type; + int level; { if (type == 0) type = void_type_node; - if (type == error_mark_node) + else if (type == error_mark_node) type = integer_type_node; - type = TYPE_MAIN_VARIANT (type); + else + type = TYPE_MAIN_VARIANT (type); switch (TREE_CODE (type)) { @@ -520,7 +530,10 @@ plain_type_1 (type) case ARRAY_TYPE: { int m; - m = plain_type_1 (TREE_TYPE (type)); + if (level >= 6) + return T_VOID; + else + m = plain_type_1 (TREE_TYPE (type), level+1); if (sdb_n_dims < SDB_MAX_DIM) sdb_dims[sdb_n_dims++] = (TYPE_DOMAIN (type) @@ -569,13 +582,21 @@ plain_type_1 (type) case POINTER_TYPE: case REFERENCE_TYPE: { - int m = plain_type_1 (TREE_TYPE (type)); + int m; + if (level >= 6) + return T_VOID; + else + m = plain_type_1 (TREE_TYPE (type), level+1); return PUSH_DERIVED_LEVEL (DT_PTR, m); } case FUNCTION_TYPE: case METHOD_TYPE: { - int m = plain_type_1 (TREE_TYPE (type)); + int m; + if (level >= 6) + return T_VOID; + else + m = plain_type_1 (TREE_TYPE (type), level+1); return PUSH_DERIVED_LEVEL (DT_FCN, m); } default: -- 2.30.2