]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
fortran: combine subarray and string computation
authorChristoph Weinmann <christoph.t.weinmann@intel.com>
Fri, 13 Nov 2015 08:00:33 +0000 (09:00 +0100)
committerBernhard Heckel <bernhard.heckel@intel.com>
Wed, 7 Sep 2016 10:08:44 +0000 (12:08 +0200)
Strings types are handled like array types with only one dimension.
Therefore the same algorithm to calculate subsets is used.

2013-11-26  Christoph Weinmann  <christoph.t.weinmann@intel.com>

* eval.c (evaluate_subexp_standard): Call
value_f90_subarray for print expressions on array and
string types.

Signed-off-by: Christoph Weinmann <christoph.t.weinmann@intel.com>
gdb/eval.c

index 40ce446517fc0cc4f4294c7b4ec516a69b96e28b..a6b729d60c80058ecfbc43099417772732c3d813 100644 (file)
@@ -2035,16 +2035,8 @@ evaluate_subexp_standard (struct type *expect_type,
       switch (code)
        {
        case TYPE_CODE_ARRAY:
-         return value_f90_subarray (arg1, exp, pos, nargs, noside);
-
        case TYPE_CODE_STRING:
-         if (exp->elts[*pos].opcode == OP_RANGE)
-           return value_f90_subarray (arg1, exp, pos, 1, noside);
-         else
-           {
-             arg2 = evaluate_subexp_with_coercion (exp, pos, noside);
-             return value_subscript (arg1, value_as_long (arg2));
-           }
+         return value_f90_subarray (arg1, exp, pos, nargs, noside);
 
        case TYPE_CODE_PTR:
        case TYPE_CODE_FUNC: