summaryrefslogtreecommitdiff
path: root/gdb/f-valprint.c
diff options
context:
space:
mode:
authorPer Bothner <per@bothner.com>1995-02-02 05:23:51 +0000
committerPer Bothner <per@bothner.com>1995-02-02 05:23:51 +0000
commit8a329002330ebe88b40210dfa64e57314275396b (patch)
treed03eee5aaf3cba3e3592cc741195d56750113666 /gdb/f-valprint.c
parentb7a24051cf6415d9482b7af73375ae5637b7cba1 (diff)
downloadbinutils-gdb-8a329002330ebe88b40210dfa64e57314275396b.tar.gz
* f-typeprint.c (f_type_print_varspec_suffix): Print array index
ranges in reverse order. * f-valprint.c (f77_create_arrayprint_offset_tbl): Fix calculation. * eval.c (evaluate_subscript): Don't call value_subscript, since it adjusts for lower bound and enforces ranges. * expression.h (exp_code): Remove MULTI_F77_SUBSCRIPT, OP_F77_SUBSTR. * eval.c, parse.c: Removed uses of removed opcodes.
Diffstat (limited to 'gdb/f-valprint.c')
-rw-r--r--gdb/f-valprint.c23
1 files changed, 7 insertions, 16 deletions
diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c
index f094971ad16..5d4c1eb93ee 100644
--- a/gdb/f-valprint.c
+++ b/gdb/f-valprint.c
@@ -225,7 +225,7 @@ f77_create_arrayprint_offset_tbl (type, stream)
FILE *stream;
{
struct type *tmp_type;
- int eltlen;
+ int eltlen;
int ndimen = 1;
int upper, lower, retcode;
@@ -246,31 +246,22 @@ f77_create_arrayprint_offset_tbl (type, stream)
F77_DIM_SIZE (ndimen) = upper - lower + 1;
- if (ndimen == 1)
- F77_DIM_OFFSET (ndimen) = 1;
- else
- F77_DIM_OFFSET (ndimen) =
- F77_DIM_OFFSET (ndimen - 1) * F77_DIM_SIZE(ndimen - 1);
-
tmp_type = TYPE_TARGET_TYPE (tmp_type);
ndimen++;
}
- eltlen = TYPE_LENGTH (tmp_type);
-
/* Now we multiply eltlen by all the offsets, so that later we
can print out array elements correctly. Up till now we
know an offset to apply to get the item but we also
have to know how much to add to get to the next item */
- tmp_type = type;
- ndimen = 1;
-
- while ((TYPE_CODE (tmp_type) == TYPE_CODE_ARRAY))
+ ndimen--;
+ eltlen = TYPE_LENGTH (tmp_type);
+ F77_DIM_OFFSET (ndimen) = eltlen;
+ while (--ndimen > 0)
{
- F77_DIM_OFFSET (ndimen) *= eltlen;
- ndimen++;
- tmp_type = TYPE_TARGET_TYPE (tmp_type);
+ eltlen *= F77_DIM_SIZE (ndimen + 1);
+ F77_DIM_OFFSET (ndimen) = eltlen;
}
}