* 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.
This commit is contained in:
Per Bothner 1995-02-02 05:23:51 +00:00
parent b7a24051cf
commit 8a32900233
4 changed files with 24 additions and 34 deletions

View File

@ -1,5 +1,14 @@
Wed Feb 1 15:44:11 1995 Per Bothner <bothner@kalessin.cygnus.com> Wed Feb 1 21:16:42 1995 Per Bothner <bothner@kalessin.cygnus.com>
* 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.
* eval.c (evaluate_subexp): Clean up handling of * eval.c (evaluate_subexp): Clean up handling of
OP_UNDETERMINED_ARGLIST (no backtracking, more general). OP_UNDETERMINED_ARGLIST (no backtracking, more general).

View File

@ -216,8 +216,9 @@ f_type_print_varspec_suffix (type, stream, show, passed_a_ptr, demangled_args)
if (arrayprint_recurse_level == 1) if (arrayprint_recurse_level == 1)
fprintf_filtered(stream,"("); fprintf_filtered(stream,"(");
else
fprintf_filtered(stream,","); if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_ARRAY)
f_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, 0, 0);
retcode = f77_get_dynamic_lowerbound (type,&lower_bound); retcode = f77_get_dynamic_lowerbound (type,&lower_bound);
@ -251,9 +252,12 @@ f_type_print_varspec_suffix (type, stream, show, passed_a_ptr, demangled_args)
fprintf_filtered(stream,"%d",upper_bound); fprintf_filtered(stream,"%d",upper_bound);
} }
f_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, 0, 0); if (TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_ARRAY)
f_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, 0, 0);
if (arrayprint_recurse_level == 1) if (arrayprint_recurse_level == 1)
fprintf_filtered (stream, ")"); fprintf_filtered (stream, ")");
else
fprintf_filtered(stream,",");
arrayprint_recurse_level--; arrayprint_recurse_level--;
break; break;

View File

@ -225,7 +225,7 @@ f77_create_arrayprint_offset_tbl (type, stream)
FILE *stream; FILE *stream;
{ {
struct type *tmp_type; struct type *tmp_type;
int eltlen; int eltlen;
int ndimen = 1; int ndimen = 1;
int upper, lower, retcode; int upper, lower, retcode;
@ -246,31 +246,22 @@ f77_create_arrayprint_offset_tbl (type, stream)
F77_DIM_SIZE (ndimen) = upper - lower + 1; 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); tmp_type = TYPE_TARGET_TYPE (tmp_type);
ndimen++; ndimen++;
} }
eltlen = TYPE_LENGTH (tmp_type);
/* Now we multiply eltlen by all the offsets, so that later we /* Now we multiply eltlen by all the offsets, so that later we
can print out array elements correctly. Up till now we can print out array elements correctly. Up till now we
know an offset to apply to get the item but we also 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 */ have to know how much to add to get to the next item */
tmp_type = type; ndimen--;
ndimen = 1; eltlen = TYPE_LENGTH (tmp_type);
F77_DIM_OFFSET (ndimen) = eltlen;
while ((TYPE_CODE (tmp_type) == TYPE_CODE_ARRAY)) while (--ndimen > 0)
{ {
F77_DIM_OFFSET (ndimen) *= eltlen; eltlen *= F77_DIM_SIZE (ndimen + 1);
ndimen++; F77_DIM_OFFSET (ndimen) = eltlen;
tmp_type = TYPE_TARGET_TYPE (tmp_type);
} }
} }

View File

@ -475,11 +475,6 @@ length_of_subexp (expr, endpos)
args = 2; args = 2;
break; break;
case OP_F77_SUBSTR:
oplen = 1;
args = 2;
break;
case OP_FUNCALL: case OP_FUNCALL:
case OP_F77_UNDETERMINED_ARGLIST: case OP_F77_UNDETERMINED_ARGLIST:
oplen = 3; oplen = 3;
@ -542,8 +537,6 @@ length_of_subexp (expr, endpos)
/* Modula-2 */ /* Modula-2 */
case MULTI_SUBSCRIPT: case MULTI_SUBSCRIPT:
/* Fortran */
case MULTI_F77_SUBSCRIPT:
oplen = 3; oplen = 3;
args = 1 + longest_to_int (expr->elts[endpos- 2].longconst); args = 1 + longest_to_int (expr->elts[endpos- 2].longconst);
break; break;
@ -620,11 +613,6 @@ prefixify_subexp (inexpr, outexpr, inend, outbeg)
args = 2; args = 2;
break; break;
case OP_F77_SUBSTR:
oplen = 1;
args = 2;
break;
case OP_FUNCALL: case OP_FUNCALL:
case OP_F77_UNDETERMINED_ARGLIST: case OP_F77_UNDETERMINED_ARGLIST:
oplen = 3; oplen = 3;
@ -691,8 +679,6 @@ prefixify_subexp (inexpr, outexpr, inend, outbeg)
/* Modula-2 */ /* Modula-2 */
case MULTI_SUBSCRIPT: case MULTI_SUBSCRIPT:
/* Fortran */
case MULTI_F77_SUBSCRIPT:
oplen = 3; oplen = 3;
args = 1 + longest_to_int (inexpr->elts[inend - 2].longconst); args = 1 + longest_to_int (inexpr->elts[inend - 2].longconst);
break; break;