* eval.c (evaluate_subexp_standard): Assert that there is at
[binutils-gdb.git] / gdb / eval.c
index 3366a061f8da580eeb9842ae08417d7961d836d0..ccb6b742b618b6a04f8840be23a34b7fc5cf4be4 100644 (file)
 #include "exceptions.h"
 #include "regcache.h"
 #include "user-regs.h"
+#include "valprint.h"
 
 #include "gdb_assert.h"
 
 /* This is defined in valops.c */
 extern int overload_resolution;
 
-/* JYG: lookup rtti type of STRUCTOP_PTR when this is set to continue
-   on with successful lookup for member/method of the rtti type. */
-extern int objectprint;
-
 /* Prototypes for local functions. */
 
 static struct value *evaluate_subexp_for_sizeof (struct expression *, int *);
@@ -319,7 +316,8 @@ evaluate_struct_tuple (struct value *struct_val,
                  fieldno++;
                  /* Skip static fields.  */
                  while (fieldno < TYPE_NFIELDS (struct_type)
-                        && TYPE_FIELD_STATIC_KIND (struct_type, fieldno))
+                        && field_is_static (&TYPE_FIELD (struct_type,
+                                                         fieldno)))
                    fieldno++;
                  subfieldno = fieldno;
                  if (fieldno >= TYPE_NFIELDS (struct_type))
@@ -1627,8 +1625,10 @@ evaluate_subexp_standard (struct type *expect_type,
         struct type *type = value_type (arg1);
         struct type *real_type;
         int full, top, using_enc;
-        
-        if (objectprint && TYPE_TARGET_TYPE(type) &&
+       struct value_print_options opts;
+
+       get_user_print_options (&opts);
+        if (opts.objectprint && TYPE_TARGET_TYPE(type) &&
             (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_CLASS))
           {
             real_type = value_rtti_target_type (arg1, &full, &top, &using_enc);
@@ -1976,6 +1976,8 @@ evaluate_subexp_standard (struct type *expect_type,
        if (nargs != ndimensions)
          error (_("Wrong number of subscripts"));
 
+       gdb_assert (nargs > 0);
+
        /* Now that we know we have a legal array subscript expression 
           let us actually find out where this element exists in the array. */
 
@@ -1994,13 +1996,8 @@ evaluate_subexp_standard (struct type *expect_type,
        /* Internal type of array is arranged right to left */
        for (i = 0; i < nargs; i++)
          {
-           retcode = f77_get_dynamic_upperbound (tmp_type, &upper);
-           if (retcode == BOUND_FETCH_ERROR)
-             error (_("Cannot obtain dynamic upper bound"));
-
-           retcode = f77_get_dynamic_lowerbound (tmp_type, &lower);
-           if (retcode == BOUND_FETCH_ERROR)
-             error (_("Cannot obtain dynamic lower bound"));
+           upper = f77_get_upperbound (tmp_type);
+           lower = f77_get_lowerbound (tmp_type);
 
            array_size_array[nargs - i - 1] = upper - lower + 1;