5c94ba0
http://sourceware.org/ml/gdb-cvs/2008-10/msg00019.html
5c94ba0
5c94ba0
gdb/
5c94ba0
2008-10-02  Jan Kratochvil  <jan.kratochvil@redhat.com>
5c94ba0
5c94ba0
	Replace TYPE_ARRAY_{UPPER,LOWER}_BOUND_TYPE by a bit if {un,}defined.
5c94ba0
	* c-typeprint.c (c_type_print_varspec_suffix), m2-typeprint.c
5c94ba0
	(m2_array), p-typeprint.c (pascal_type_print_varspec_prefix),
5c94ba0
	valops.c (value_cast), varobj.c (c_number_of_children): Replace
5c94ba0
	TYPE_ARRAY_UPPER_BOUND_TYPE compared to BOUND_CANNOT_BE_DETERMINED by
5c94ba0
	TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED.
5c94ba0
	* parse.c (follow_types): Use TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED.
5c94ba0
	* f-valprint.c (f77_get_dynamic_upperbound): Replace with ...
5c94ba0
	(f77_get_upperbound): ... this function handling now only
5c94ba0
	TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED.
5c94ba0
	(f77_get_dynamic_lowerbound): Replace with ...
5c94ba0
	(f77_get_lowerbound): ... this function handling now only
5c94ba0
	TYPE_ARRAY_LOWER_BOUND_IS_UNDEFINED.
5c94ba0
	(f77_get_dynamic_length_of_aggregate, f77_create_arrayprint_offset_tbl):
5c94ba0
	Update their callers.
5c94ba0
	* eval.c (evaluate_subexp_standard): Update their callers.
5c94ba0
	* f-lang.h (f77_get_dynamic_upperbound, f77_get_upperbound)
5c94ba0
	(f77_get_dynamic_lowerbound, f77_get_lowerbound): Update their
5c94ba0
	prototypes.
5c94ba0
	(BOUND_FETCH_OK, BOUND_FETCH_ERROR): Remove.
5c94ba0
	* f-typeprint.c (f_type_print_varspec_suffix, f_type_print_base): Remove
5c94ba0
	the lower_bound_was_default variable.  Update the
5c94ba0
	f77_get_dynamic_upperbound, f77_get_upperbound and
5c94ba0
	TYPE_ARRAY_UPPER_BOUND_TYPE calls.
5c94ba0
	* gdbtypes.c (print_bound_type): Remove the function.
5c94ba0
	(recursive_dump_type): Remove its calls printing UPPER_BOUND_TYPE and
5c94ba0
	LOWER_BOUND_TYPE.
5c94ba0
	* gdbtypes.h (enum array_bound_type): Remove.
5c94ba0
	(struct main_type): Remove the fields upper_bound_type and
5c94ba0
	lower_bound_type.  Comment the new overload of the field artificial.
5c94ba0
	(TYPE_ARRAY_UPPER_BOUND_TYPE): Replace by ...
5c94ba0
	(TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED): ... this macro.
5c94ba0
	(TYPE_ARRAY_LOWER_BOUND_TYPE): Replace by ...
5c94ba0
	(TYPE_ARRAY_LOWER_BOUND_IS_UNDEFINED): ... this macro.
5c94ba0
5c94ba0
gdb/testsuite/
5c94ba0
2008-10-02  Jan Kratochvil  <jan.kratochvil@redhat.com>
5c94ba0
5c94ba0
	* gdb.base/maint.exp (maint print type): Remove printing
5c94ba0
	UPPER_BOUND_TYPE and LOWER_BOUND_TYPE.
5c94ba0
5c94ba0
[ Ported to gdb-6.8fedora.  ]
5c94ba0
5c94ba0
--- ./gdb/c-typeprint.c	2008-01-01 23:53:09.000000000 +0100
5c94ba0
+++ ./gdb/c-typeprint.c	2008-10-29 10:55:07.000000000 +0100
5c94ba0
@@ -542,7 +542,7 @@ c_type_print_varspec_suffix (struct type
5c94ba0
 
5c94ba0
       fprintf_filtered (stream, "[");
5c94ba0
       if (TYPE_LENGTH (TYPE_TARGET_TYPE (type)) > 0
5c94ba0
-	&& TYPE_ARRAY_UPPER_BOUND_TYPE (type) != BOUND_CANNOT_BE_DETERMINED)
5c94ba0
+	&& !TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type))
5c94ba0
 	fprintf_filtered (stream, "%d",
5c94ba0
 			  (TYPE_LENGTH (type)
5c94ba0
 			   / TYPE_LENGTH (TYPE_TARGET_TYPE (type))));
5c94ba0
--- ./gdb/eval.c	2008-10-29 10:50:23.000000000 +0100
5c94ba0
+++ ./gdb/eval.c	2008-10-29 10:55:07.000000000 +0100
5c94ba0
@@ -1674,13 +1674,8 @@ evaluate_subexp_standard (struct type *e
5c94ba0
 	/* Internal type of array is arranged right to left */
5c94ba0
 	for (i = 0; i < nargs; i++)
5c94ba0
 	  {
5c94ba0
-	    retcode = f77_get_dynamic_upperbound (tmp_type, &upper);
5c94ba0
-	    if (retcode == BOUND_FETCH_ERROR)
5c94ba0
-	      error (_("Cannot obtain dynamic upper bound"));
5c94ba0
-
5c94ba0
-	    retcode = f77_get_dynamic_lowerbound (tmp_type, &lower);
5c94ba0
-	    if (retcode == BOUND_FETCH_ERROR)
5c94ba0
-	      error (_("Cannot obtain dynamic lower bound"));
5c94ba0
+	    upper = f77_get_upperbound (tmp_type);
5c94ba0
+	    lower = f77_get_lowerbound (tmp_type);
5c94ba0
 
5c94ba0
 	    array_size_array[nargs - i - 1] = upper - lower + 1;
5c94ba0
 
5c94ba0
--- ./gdb/f-lang.h	2008-10-29 10:50:23.000000000 +0100
5c94ba0
+++ ./gdb/f-lang.h	2008-10-29 10:55:07.000000000 +0100
5c94ba0
@@ -83,9 +83,6 @@ extern SAVED_F77_COMMON_PTR find_common_
5c94ba0
 #define BLANK_COMMON_NAME_MF77     "__BLNK__"	/* MF77 assigned  */
5c94ba0
 #define BLANK_COMMON_NAME_LOCAL    "__BLANK"	/* Local GDB */
5c94ba0
 
5c94ba0
-#define BOUND_FETCH_OK 1
5c94ba0
-#define BOUND_FETCH_ERROR -999
5c94ba0
-
5c94ba0
 /* When reasonable array bounds cannot be fetched, such as when 
5c94ba0
    you ask to 'mt print symbols' and there is no stack frame and 
5c94ba0
    therefore no way of knowing the bounds of stack-based arrays, 
5c94ba0
@@ -97,9 +94,9 @@ extern SAVED_F77_COMMON_PTR find_common_
5c94ba0
 extern char *real_main_name;	/* Name of main function */
5c94ba0
 extern int real_main_c_value;	/* C_value field of main function */
5c94ba0
 
5c94ba0
-extern int f77_get_dynamic_upperbound (struct type *, int *);
5c94ba0
+extern int f77_get_upperbound (struct type *);
5c94ba0
 
5c94ba0
-extern int f77_get_dynamic_lowerbound (struct type *, int *);
5c94ba0
+extern int f77_get_lowerbound (struct type *);
5c94ba0
 
5c94ba0
 extern void f77_get_dynamic_array_length (struct type *);
5c94ba0
 
5c94ba0
--- ./gdb/f-typeprint.c	2008-10-29 10:50:23.000000000 +0100
5c94ba0
+++ ./gdb/f-typeprint.c	2008-10-29 10:55:07.000000000 +0100
5c94ba0
@@ -150,7 +150,6 @@ f_type_print_varspec_suffix (struct type
5c94ba0
 			     int show, int passed_a_ptr, int demangled_args)
5c94ba0
 {
5c94ba0
   int upper_bound, lower_bound;
5c94ba0
-  int lower_bound_was_default = 0;
5c94ba0
   static int arrayprint_recurse_level = 0;
5c94ba0
   int retcode;
5c94ba0
 
5c94ba0
@@ -173,35 +172,19 @@ f_type_print_varspec_suffix (struct type
5c94ba0
       if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_ARRAY)
5c94ba0
 	f_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, 0, 0);
5c94ba0
 
5c94ba0
-      retcode = f77_get_dynamic_lowerbound (type, &lower_bound);
5c94ba0
-
5c94ba0
-      lower_bound_was_default = 0;
5c94ba0
-
5c94ba0
-      if (retcode == BOUND_FETCH_ERROR)
5c94ba0
-	fprintf_filtered (stream, "???");
5c94ba0
-      else if (lower_bound == 1)	/* The default */
5c94ba0
-	lower_bound_was_default = 1;
5c94ba0
-      else
5c94ba0
-	fprintf_filtered (stream, "%d", lower_bound);
5c94ba0
-
5c94ba0
-      if (lower_bound_was_default)
5c94ba0
-	lower_bound_was_default = 0;
5c94ba0
-      else
5c94ba0
-	fprintf_filtered (stream, ":");
5c94ba0
+      lower_bound = f77_get_lowerbound (type);
5c94ba0
+      if (lower_bound != 1)	/* Not the default.  */
5c94ba0
+	fprintf_filtered (stream, "%d:", lower_bound);
5c94ba0
 
5c94ba0
       /* Make sure that, if we have an assumed size array, we
5c94ba0
          print out a warning and print the upperbound as '*' */
5c94ba0
 
5c94ba0
-      if (TYPE_ARRAY_UPPER_BOUND_TYPE (type) == BOUND_CANNOT_BE_DETERMINED)
5c94ba0
+      if (TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type))
5c94ba0
 	fprintf_filtered (stream, "*");
5c94ba0
       else
5c94ba0
 	{
5c94ba0
-	  retcode = f77_get_dynamic_upperbound (type, &upper_bound);
5c94ba0
-
5c94ba0
-	  if (retcode == BOUND_FETCH_ERROR)
5c94ba0
-	    fprintf_filtered (stream, "???");
5c94ba0
-	  else
5c94ba0
-	    fprintf_filtered (stream, "%d", upper_bound);
5c94ba0
+	  upper_bound = f77_get_upperbound (type);
5c94ba0
+	  fprintf_filtered (stream, "%d", upper_bound);
5c94ba0
 	}
5c94ba0
 
5c94ba0
       if (TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_ARRAY)
5c94ba0
@@ -351,16 +334,12 @@ f_type_print_base (struct type *type, st
5c94ba0
     case TYPE_CODE_STRING:
5c94ba0
       /* Strings may have dynamic upperbounds (lengths) like arrays. */
5c94ba0
 
5c94ba0
-      if (TYPE_ARRAY_UPPER_BOUND_TYPE (type) == BOUND_CANNOT_BE_DETERMINED)
5c94ba0
+      if (TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type))
5c94ba0
 	fprintfi_filtered (level, stream, "character*(*)");
5c94ba0
       else
5c94ba0
 	{
5c94ba0
-	  retcode = f77_get_dynamic_upperbound (type, &upper_bound);
5c94ba0
-
5c94ba0
-	  if (retcode == BOUND_FETCH_ERROR)
5c94ba0
-	    fprintf_filtered (stream, "character*???");
5c94ba0
-	  else
5c94ba0
-	    fprintf_filtered (stream, "character*%d", upper_bound);
5c94ba0
+	  upper_bound = f77_get_upperbound (type);
5c94ba0
+	  fprintf_filtered (stream, "character*%d", upper_bound);
5c94ba0
 	}
5c94ba0
       break;
5c94ba0
 
5c94ba0
--- ./gdb/f-valprint.c	2008-10-29 10:50:23.000000000 +0100
5c94ba0
+++ ./gdb/f-valprint.c	2008-10-29 20:48:30.000000000 +0100
5c94ba0
@@ -61,130 +61,28 @@ int f77_array_offset_tbl[MAX_FORTRAN_DIM
5c94ba0
 #define F77_DIM_OFFSET(n) (f77_array_offset_tbl[n][0])
5c94ba0
 
5c94ba0
 int
5c94ba0
-f77_get_dynamic_lowerbound (struct type *type, int *lower_bound)
5c94ba0
+f77_get_lowerbound (struct type *type)
5c94ba0
 {
5c94ba0
-  struct frame_info *frame;
5c94ba0
-  CORE_ADDR current_frame_addr;
5c94ba0
-  CORE_ADDR ptr_to_lower_bound;
5c94ba0
-
5c94ba0
-  switch (TYPE_ARRAY_LOWER_BOUND_TYPE (type))
5c94ba0
-    {
5c94ba0
-    case BOUND_BY_VALUE_ON_STACK:
5c94ba0
-      frame = deprecated_safe_get_selected_frame ();
5c94ba0
-      current_frame_addr = get_frame_base (frame);
5c94ba0
-      if (current_frame_addr > 0)
5c94ba0
-	{
5c94ba0
-	  *lower_bound =
5c94ba0
-	    read_memory_integer (current_frame_addr +
5c94ba0
-				 TYPE_ARRAY_LOWER_BOUND_VALUE (type),
5c94ba0
-				 4);
5c94ba0
-	}
5c94ba0
-      else
5c94ba0
-	{
5c94ba0
-	  *lower_bound = DEFAULT_LOWER_BOUND;
5c94ba0
-	  return BOUND_FETCH_ERROR;
5c94ba0
-	}
5c94ba0
-      break;
5c94ba0
-
5c94ba0
-    case BOUND_SIMPLE:
5c94ba0
-      *lower_bound = TYPE_ARRAY_LOWER_BOUND_VALUE (type);
5c94ba0
-      break;
5c94ba0
-
5c94ba0
-    case BOUND_CANNOT_BE_DETERMINED:
5c94ba0
-      error (_("Lower bound may not be '*' in F77"));
5c94ba0
-      break;
5c94ba0
-
5c94ba0
-    case BOUND_BY_REF_ON_STACK:
5c94ba0
-      frame = deprecated_safe_get_selected_frame ();
5c94ba0
-      current_frame_addr = get_frame_base (frame);
5c94ba0
-      if (current_frame_addr > 0)
5c94ba0
-	{
5c94ba0
-	  ptr_to_lower_bound =
5c94ba0
-	    read_memory_typed_address (current_frame_addr +
5c94ba0
-				       TYPE_ARRAY_LOWER_BOUND_VALUE (type),
5c94ba0
-				       builtin_type_void_data_ptr);
5c94ba0
-	  *lower_bound = read_memory_integer (ptr_to_lower_bound, 4);
5c94ba0
-	}
5c94ba0
-      else
5c94ba0
-	{
5c94ba0
-	  *lower_bound = DEFAULT_LOWER_BOUND;
5c94ba0
-	  return BOUND_FETCH_ERROR;
5c94ba0
-	}
5c94ba0
-      break;
5c94ba0
+  if (TYPE_ARRAY_LOWER_BOUND_IS_UNDEFINED (type))
5c94ba0
+    error (_("Lower bound may not be '*' in F77"));
5c94ba0
 
5c94ba0
-    case BOUND_BY_REF_IN_REG:
5c94ba0
-    case BOUND_BY_VALUE_IN_REG:
5c94ba0
-    default:
5c94ba0
-      error (_("??? unhandled dynamic array bound type ???"));
5c94ba0
-      break;
5c94ba0
-    }
5c94ba0
-  return BOUND_FETCH_OK;
5c94ba0
+  return TYPE_ARRAY_LOWER_BOUND_VALUE (type);
5c94ba0
 }
5c94ba0
 
5c94ba0
 int
5c94ba0
-f77_get_dynamic_upperbound (struct type *type, int *upper_bound)
5c94ba0
+f77_get_upperbound (struct type *type)
5c94ba0
 {
5c94ba0
-  struct frame_info *frame;
5c94ba0
-  CORE_ADDR current_frame_addr = 0;
5c94ba0
-  CORE_ADDR ptr_to_upper_bound;
5c94ba0
-
5c94ba0
-  switch (TYPE_ARRAY_UPPER_BOUND_TYPE (type))
5c94ba0
-    {
5c94ba0
-    case BOUND_BY_VALUE_ON_STACK:
5c94ba0
-      frame = deprecated_safe_get_selected_frame ();
5c94ba0
-      current_frame_addr = get_frame_base (frame);
5c94ba0
-      if (current_frame_addr > 0)
5c94ba0
-	{
5c94ba0
-	  *upper_bound =
5c94ba0
-	    read_memory_integer (current_frame_addr +
5c94ba0
-				 TYPE_ARRAY_UPPER_BOUND_VALUE (type),
5c94ba0
-				 4);
5c94ba0
-	}
5c94ba0
-      else
5c94ba0
-	{
5c94ba0
-	  *upper_bound = DEFAULT_UPPER_BOUND;
5c94ba0
-	  return BOUND_FETCH_ERROR;
5c94ba0
-	}
5c94ba0
-      break;
5c94ba0
-
5c94ba0
-    case BOUND_SIMPLE:
5c94ba0
-      *upper_bound = TYPE_ARRAY_UPPER_BOUND_VALUE (type);
5c94ba0
-      break;
5c94ba0
-
5c94ba0
-    case BOUND_CANNOT_BE_DETERMINED:
5c94ba0
-      /* we have an assumed size array on our hands. Assume that 
5c94ba0
-         upper_bound == lower_bound so that we show at least 
5c94ba0
-         1 element.If the user wants to see more elements, let 
5c94ba0
-         him manually ask for 'em and we'll subscript the 
5c94ba0
-         array and show him */
5c94ba0
-      f77_get_dynamic_lowerbound (type, upper_bound);
5c94ba0
-      break;
5c94ba0
-
5c94ba0
-    case BOUND_BY_REF_ON_STACK:
5c94ba0
-      frame = deprecated_safe_get_selected_frame ();
5c94ba0
-      current_frame_addr = get_frame_base (frame);
5c94ba0
-      if (current_frame_addr > 0)
5c94ba0
-	{
5c94ba0
-	  ptr_to_upper_bound =
5c94ba0
-	    read_memory_typed_address (current_frame_addr +
5c94ba0
-				       TYPE_ARRAY_UPPER_BOUND_VALUE (type),
5c94ba0
-				       builtin_type_void_data_ptr);
5c94ba0
-	  *upper_bound = read_memory_integer (ptr_to_upper_bound, 4);
5c94ba0
-	}
5c94ba0
-      else
5c94ba0
-	{
5c94ba0
-	  *upper_bound = DEFAULT_UPPER_BOUND;
5c94ba0
-	  return BOUND_FETCH_ERROR;
5c94ba0
-	}
5c94ba0
-      break;
5c94ba0
+  if (TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type))
5c94ba0
+    {
5c94ba0
+      /* We have an assumed size array on our hands.  Assume that
5c94ba0
+	 upper_bound == lower_bound so that we show at least 1 element.
5c94ba0
+	 If the user wants to see more elements, let him manually ask for 'em
5c94ba0
+	 and we'll subscript the array and show him.  */
5c94ba0
 
5c94ba0
-    case BOUND_BY_REF_IN_REG:
5c94ba0
-    case BOUND_BY_VALUE_IN_REG:
5c94ba0
-    default:
5c94ba0
-      error (_("??? unhandled dynamic array bound type ???"));
5c94ba0
-      break;
5c94ba0
+      return f77_get_lowerbound (type);
5c94ba0
     }
5c94ba0
-  return BOUND_FETCH_OK;
5c94ba0
+
5c94ba0
+  return TYPE_ARRAY_UPPER_BOUND_VALUE (type);
5c94ba0
 }
5c94ba0
 
5c94ba0
 /* Obtain F77 adjustable array dimensions */
5c94ba0
@@ -210,13 +108,8 @@ f77_get_dynamic_length_of_aggregate (str
5c94ba0
     f77_get_dynamic_length_of_aggregate (TYPE_TARGET_TYPE (type));
5c94ba0
 
5c94ba0
   /* Recursion ends here, start setting up lengths.  */
5c94ba0
-  retcode = f77_get_dynamic_lowerbound (type, &lower_bound);
5c94ba0
-  if (retcode == BOUND_FETCH_ERROR)
5c94ba0
-    error (_("Cannot obtain valid array lower bound"));
5c94ba0
-
5c94ba0
-  retcode = f77_get_dynamic_upperbound (type, &upper_bound);
5c94ba0
-  if (retcode == BOUND_FETCH_ERROR)
5c94ba0
-    error (_("Cannot obtain valid array upper bound"));
5c94ba0
+  lower_bound = f77_get_lowerbound (type);
5c94ba0
+  upper_bound = f77_get_upperbound (type);
5c94ba0
 
5c94ba0
   /* Patch in a valid length value. */
5c94ba0
 
5c94ba0
@@ -239,16 +132,8 @@ f77_create_arrayprint_offset_tbl (struct
5c94ba0
 
5c94ba0
   while ((TYPE_CODE (tmp_type) == TYPE_CODE_ARRAY))
5c94ba0
     {
5c94ba0
-      if (TYPE_ARRAY_UPPER_BOUND_TYPE (tmp_type) == BOUND_CANNOT_BE_DETERMINED)
5c94ba0
-	fprintf_filtered (stream, "<assumed size array> ");
5c94ba0
-
5c94ba0
-      retcode = f77_get_dynamic_upperbound (tmp_type, &upper);
5c94ba0
-      if (retcode == BOUND_FETCH_ERROR)
5c94ba0
-	error (_("Cannot obtain dynamic upper bound"));
5c94ba0
-
5c94ba0
-      retcode = f77_get_dynamic_lowerbound (tmp_type, &lower);
5c94ba0
-      if (retcode == BOUND_FETCH_ERROR)
5c94ba0
-	error (_("Cannot obtain dynamic lower bound"));
5c94ba0
+      upper = f77_get_upperbound (tmp_type);
5c94ba0
+      lower = f77_get_lowerbound (tmp_type);
5c94ba0
 
5c94ba0
       F77_DIM_SIZE (ndimen) = upper - lower + 1;
5c94ba0
 
5c94ba0
--- ./gdb/gdbtypes.c	2008-10-29 10:50:23.000000000 +0100
5c94ba0
+++ ./gdb/gdbtypes.c	2008-10-29 10:55:07.000000000 +0100
5c94ba0
@@ -2529,35 +2529,6 @@ print_cplus_stuff (struct type *type, in
5c94ba0
     }
5c94ba0
 }
5c94ba0
 
5c94ba0
-static void
5c94ba0
-print_bound_type (int bt)
5c94ba0
-{
5c94ba0
-  switch (bt)
5c94ba0
-    {
5c94ba0
-    case BOUND_CANNOT_BE_DETERMINED:
5c94ba0
-      printf_filtered ("(BOUND_CANNOT_BE_DETERMINED)");
5c94ba0
-      break;
5c94ba0
-    case BOUND_BY_REF_ON_STACK:
5c94ba0
-      printf_filtered ("(BOUND_BY_REF_ON_STACK)");
5c94ba0
-      break;
5c94ba0
-    case BOUND_BY_VALUE_ON_STACK:
5c94ba0
-      printf_filtered ("(BOUND_BY_VALUE_ON_STACK)");
5c94ba0
-      break;
5c94ba0
-    case BOUND_BY_REF_IN_REG:
5c94ba0
-      printf_filtered ("(BOUND_BY_REF_IN_REG)");
5c94ba0
-      break;
5c94ba0
-    case BOUND_BY_VALUE_IN_REG:
5c94ba0
-      printf_filtered ("(BOUND_BY_VALUE_IN_REG)");
5c94ba0
-      break;
5c94ba0
-    case BOUND_SIMPLE:
5c94ba0
-      printf_filtered ("(BOUND_SIMPLE)");
5c94ba0
-      break;
5c94ba0
-    default:
5c94ba0
-      printf_filtered (_("(unknown bound type)"));
5c94ba0
-      break;
5c94ba0
-    }
5c94ba0
-}
5c94ba0
-
5c94ba0
 static struct obstack dont_print_type_obstack;
5c94ba0
 
5c94ba0
 void
5c94ba0
@@ -2692,14 +2663,6 @@ recursive_dump_type (struct type *type, 
5c94ba0
     }
5c94ba0
   puts_filtered ("\n");
5c94ba0
   printfi_filtered (spaces, "length %d\n", TYPE_LENGTH (type));
5c94ba0
-  printfi_filtered (spaces, "upper_bound_type 0x%x ",
5c94ba0
-		    TYPE_ARRAY_UPPER_BOUND_TYPE (type));
5c94ba0
-  print_bound_type (TYPE_ARRAY_UPPER_BOUND_TYPE (type));
5c94ba0
-  puts_filtered ("\n");
5c94ba0
-  printfi_filtered (spaces, "lower_bound_type 0x%x ",
5c94ba0
-		    TYPE_ARRAY_LOWER_BOUND_TYPE (type));
5c94ba0
-  print_bound_type (TYPE_ARRAY_LOWER_BOUND_TYPE (type));
5c94ba0
-  puts_filtered ("\n");
5c94ba0
   printfi_filtered (spaces, "objfile ");
5c94ba0
   gdb_print_host_address (TYPE_OBJFILE (type), gdb_stdout);
5c94ba0
   printf_filtered ("\n");
5c94ba0
@@ -2942,10 +2942,6 @@ copy_type_recursive (struct objfile *obj
5c94ba0
 
5c94ba0
   /* Copy the common fields of types.  */
5c94ba0
   TYPE_CODE (new_type) = TYPE_CODE (type);
5c94ba0
-  TYPE_ARRAY_UPPER_BOUND_TYPE (new_type) = 
5c94ba0
-    TYPE_ARRAY_UPPER_BOUND_TYPE (type);
5c94ba0
-  TYPE_ARRAY_LOWER_BOUND_TYPE (new_type) = 
5c94ba0
-    TYPE_ARRAY_LOWER_BOUND_TYPE (type);
5c94ba0
   if (TYPE_NAME (type))
5c94ba0
     TYPE_NAME (new_type) = xstrdup (TYPE_NAME (type));
5c94ba0
   if (TYPE_TAG_NAME (type))
5c94ba0
--- ./gdb/gdbtypes.h	2008-10-29 10:50:23.000000000 +0100
5c94ba0
+++ ./gdb/gdbtypes.h	2008-10-29 10:56:05.000000000 +0100
5c94ba0
@@ -310,17 +310,6 @@ enum type_code
5c94ba0
 #define TYPE_FLAG_NOTTEXT	(1 << 17)
5c94ba0
 #define TYPE_NOTTEXT(t)		(TYPE_FLAGS (t) & TYPE_FLAG_NOTTEXT)
5c94ba0
 
5c94ba0
-/*  Array bound type.  */
5c94ba0
-enum array_bound_type
5c94ba0
-{
5c94ba0
-  BOUND_SIMPLE = 0,
5c94ba0
-  BOUND_BY_VALUE_IN_REG,
5c94ba0
-  BOUND_BY_REF_IN_REG,
5c94ba0
-  BOUND_BY_VALUE_ON_STACK,
5c94ba0
-  BOUND_BY_REF_ON_STACK,
5c94ba0
-  BOUND_CANNOT_BE_DETERMINED
5c94ba0
-};
5c94ba0
-
5c94ba0
 /* This structure is space-critical.
5c94ba0
    Its layout has been tweaked to reduce the space used.  */
5c94ba0
 
5c94ba0
@@ -330,12 +319,6 @@ struct main_type
5c94ba0
 
5c94ba0
   ENUM_BITFIELD(type_code) code : 8;
5c94ba0
 
5c94ba0
-  /* Array bounds.  These fields appear at this location because
5c94ba0
-     they pack nicely here.  */
5c94ba0
-
5c94ba0
-  ENUM_BITFIELD(array_bound_type) upper_bound_type : 4;
5c94ba0
-  ENUM_BITFIELD(array_bound_type) lower_bound_type : 4;
5c94ba0
-
5c94ba0
   /* Name of this type, or NULL if none.
5c94ba0
 
5c94ba0
      This is used for printing only, except by poorly designed C++ code.
5c94ba0
@@ -437,7 +420,8 @@ struct main_type
5c94ba0
 
5c94ba0
     /* For a function or member type, this is 1 if the argument is marked
5c94ba0
        artificial.  Artificial arguments should not be shown to the
5c94ba0
-       user.  */
5c94ba0
+       user.  For TYPE_CODE_RANGE it is set if the specific bound is not
5c94ba0
+       defined.  */
5c94ba0
     unsigned int artificial : 1;
5c94ba0
 
5c94ba0
     /* This flag is zero for non-static fields, 1 for fields whose location
5c94ba0
@@ -802,10 +786,10 @@ extern void allocate_cplus_struct_type (
5c94ba0
 
5c94ba0
 /* Moto-specific stuff for FORTRAN arrays */
5c94ba0
 
5c94ba0
-#define TYPE_ARRAY_UPPER_BOUND_TYPE(thistype) \
5c94ba0
-	TYPE_MAIN_TYPE(thistype)->upper_bound_type
5c94ba0
-#define TYPE_ARRAY_LOWER_BOUND_TYPE(thistype) \
5c94ba0
-	TYPE_MAIN_TYPE(thistype)->lower_bound_type
5c94ba0
+#define TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED(arraytype) \
5c94ba0
+   (TYPE_FIELD_ARTIFICIAL((TYPE_FIELD_TYPE((arraytype),0)),1))
5c94ba0
+#define TYPE_ARRAY_LOWER_BOUND_IS_UNDEFINED(arraytype) \
5c94ba0
+   (TYPE_FIELD_ARTIFICIAL((TYPE_FIELD_TYPE((arraytype),0)),0))
5c94ba0
 
5c94ba0
 #define TYPE_ARRAY_UPPER_BOUND_VALUE(arraytype) \
5c94ba0
    (TYPE_FIELD_BITPOS((TYPE_FIELD_TYPE((arraytype),0)),1))
5c94ba0
--- ./gdb/m2-typeprint.c	2008-01-01 23:53:11.000000000 +0100
5c94ba0
+++ ./gdb/m2-typeprint.c	2008-10-29 10:55:12.000000000 +0100
5c94ba0
@@ -202,7 +202,7 @@ static void m2_array (struct type *type,
5c94ba0
 {
5c94ba0
   fprintf_filtered (stream, "ARRAY [");
5c94ba0
   if (TYPE_LENGTH (TYPE_TARGET_TYPE (type)) > 0
5c94ba0
-      && TYPE_ARRAY_UPPER_BOUND_TYPE (type) != BOUND_CANNOT_BE_DETERMINED)
5c94ba0
+      && !TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type))
5c94ba0
     {
5c94ba0
       if (TYPE_INDEX_TYPE (type) != 0)
5c94ba0
 	{
5c94ba0
--- ./gdb/p-typeprint.c	2008-01-01 23:53:12.000000000 +0100
5c94ba0
+++ ./gdb/p-typeprint.c	2008-10-29 10:55:12.000000000 +0100
5c94ba0
@@ -251,7 +251,7 @@ pascal_type_print_varspec_prefix (struct
5c94ba0
 	fprintf_filtered (stream, "(");
5c94ba0
       fprintf_filtered (stream, "array ");
5c94ba0
       if (TYPE_LENGTH (TYPE_TARGET_TYPE (type)) > 0
5c94ba0
-	&& TYPE_ARRAY_UPPER_BOUND_TYPE (type) != BOUND_CANNOT_BE_DETERMINED)
5c94ba0
+	&& !TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type))
5c94ba0
 	fprintf_filtered (stream, "[%d..%d] ",
5c94ba0
 			  TYPE_ARRAY_LOWER_BOUND_VALUE (type),
5c94ba0
 			  TYPE_ARRAY_UPPER_BOUND_VALUE (type)
5c94ba0
--- ./gdb/parse.c	2008-10-29 10:47:18.000000000 +0100
5c94ba0
+++ ./gdb/parse.c	2008-10-29 10:55:12.000000000 +0100
5c94ba0
@@ -1175,8 +1175,7 @@ follow_types (struct type *follow_type)
5c94ba0
 	  create_array_type ((struct type *) NULL,
5c94ba0
 			     follow_type, range_type);
5c94ba0
 	if (array_size < 0)
5c94ba0
-	  TYPE_ARRAY_UPPER_BOUND_TYPE (follow_type)
5c94ba0
-	    = BOUND_CANNOT_BE_DETERMINED;
5c94ba0
+	  TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (follow_type) = 1;
5c94ba0
 	break;
5c94ba0
       case tp_function:
5c94ba0
 	/* FIXME-type-allocation: need a way to free this type when we are
5c94ba0
--- ./gdb/testsuite/gdb.base/maint.exp	2008-01-28 19:06:59.000000000 +0100
5c94ba0
+++ ./gdb/testsuite/gdb.base/maint.exp	2008-10-29 20:50:33.000000000 +0100
5c94ba0
@@ -404,7 +404,7 @@ gdb_expect  {
5c94ba0
 
5c94ba0
 send_gdb "maint print type argc\n"
5c94ba0
 gdb_expect  {
5c94ba0
-        -re "type node $hex\r\nname .int. \\($hex\\)\r\ntagname .<NULL>. \\($hex\\)\r\ncode $hex \\(TYPE_CODE_INT\\)\r\nlength \[24\]\r\nupper_bound_type $hex \\(BOUND_SIMPLE\\)\r\nlower_bound_type $hex \\(BOUND_SIMPLE\\)\r\nobjfile $hex\r\ntarget_type $hex\r\npointer_type $hex\r\nreference_type $hex\r\ntype_chain $hex\r\ninstance_flags $hex\r\nflags $hex\r\nnfields 0 $hex\r\nvptr_basetype $hex\r\nvptr_fieldno -1\r\ntype_specific $hex\r\n$gdb_prompt $"\
5c94ba0
+        -re "type node $hex\r\nname .int. \\($hex\\)\r\ntagname .<NULL>. \\($hex\\)\r\ncode $hex \\(TYPE_CODE_INT\\)\r\nlength \[24\]\r\nobjfile $hex\r\ntarget_type $hex\r\npointer_type $hex\r\nreference_type $hex\r\ntype_chain $hex\r\ninstance_flags $hex\r\nflags $hex\r\nnfields 0 $hex\r\nvptr_basetype $hex\r\nvptr_fieldno -1\r\ntype_specific $hex\r\n$gdb_prompt $"\
5c94ba0
                         { pass "maint print type" }
5c94ba0
         -re ".*$gdb_prompt $"       { fail "maint print type" }
5c94ba0
         timeout         { fail "(timeout) maint print type" }
5c94ba0
--- ./gdb/valops.c	2008-10-29 10:50:23.000000000 +0100
5c94ba0
+++ ./gdb/valops.c	2008-10-29 10:55:12.000000000 +0100
5c94ba0
@@ -291,8 +291,7 @@ value_cast (struct type *type, struct va
5c94ba0
     {
5c94ba0
       struct type *element_type = TYPE_TARGET_TYPE (type);
5c94ba0
       unsigned element_length = TYPE_LENGTH (check_typedef (element_type));
5c94ba0
-      if (element_length > 0
5c94ba0
-	&& TYPE_ARRAY_UPPER_BOUND_TYPE (type) == BOUND_CANNOT_BE_DETERMINED)
5c94ba0
+      if (element_length > 0 && TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type))
5c94ba0
 	{
5c94ba0
 	  struct type *range_type = TYPE_INDEX_TYPE (type);
5c94ba0
 	  int val_length = TYPE_LENGTH (type2);
5c94ba0
--- ./gdb/varobj.c	2008-10-29 10:47:21.000000000 +0100
5c94ba0
+++ ./gdb/varobj.c	2008-10-29 10:55:12.000000000 +0100
5c94ba0
@@ -1988,7 +1988,7 @@ c_number_of_children (struct varobj *var
5c94ba0
     {
5c94ba0
     case TYPE_CODE_ARRAY:
5c94ba0
       if (TYPE_LENGTH (type) > 0 && TYPE_LENGTH (target) > 0
5c94ba0
-	  && TYPE_ARRAY_UPPER_BOUND_TYPE (type) != BOUND_CANNOT_BE_DETERMINED)
5c94ba0
+	  && !TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type))
5c94ba0
 	children = TYPE_LENGTH (type) / TYPE_LENGTH (target);
5c94ba0
       else
5c94ba0
 	/* If we don't know how many elements there are, don't display