aboutsummaryrefslogtreecommitdiff
path: root/gdb/f-exp.y
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2019-01-17 16:30:35 +0000
committerAndrew Burgess <andrew.burgess@embecosm.com>2019-03-06 18:11:31 +0000
commit3be47f7aa99dc90190e642a4e191c9f049e0a934 (patch)
tree2b8b91477c7ad5b4bdeb68080f9f82df2180a2cc /gdb/f-exp.y
parent4d00f5d8f6c4a1c9f334b1abb45b9ce05fb45b0a (diff)
downloadfsf-binutils-gdb-3be47f7aa99dc90190e642a4e191c9f049e0a934.zip
fsf-binutils-gdb-3be47f7aa99dc90190e642a4e191c9f049e0a934.tar.gz
fsf-binutils-gdb-3be47f7aa99dc90190e642a4e191c9f049e0a934.tar.bz2
gdb/fortran: Expand the set of types that support (kind=N)
Expand the number of types that can be adjusted with a (kind=N) type extension. gdb/ChangeLog: * f-exp.y (convert_to_kind_type): Handle more type kinds. gdb/testsuite/ChangeLog: * gdb.fortran/type-kinds.exp (test_cast_1_to_type_kind): New function. (test_basic_parsing_of_type_kinds): Expand types tested. (test_parsing_invalid_type_kinds): New function.
Diffstat (limited to 'gdb/f-exp.y')
-rw-r--r--gdb/f-exp.y36
1 files changed, 36 insertions, 0 deletions
diff --git a/gdb/f-exp.y b/gdb/f-exp.y
index 327f137..980ee4b4 100644
--- a/gdb/f-exp.y
+++ b/gdb/f-exp.y
@@ -830,6 +830,42 @@ convert_to_kind_type (struct type *basetype, int kind)
if (kind == 1)
return parse_f_type (pstate)->builtin_character;
}
+ else if (basetype == parse_f_type (pstate)->builtin_complex_s8)
+ {
+ if (kind == 4)
+ return parse_f_type (pstate)->builtin_complex_s8;
+ else if (kind == 8)
+ return parse_f_type (pstate)->builtin_complex_s16;
+ else if (kind == 16)
+ return parse_f_type (pstate)->builtin_complex_s32;
+ }
+ else if (basetype == parse_f_type (pstate)->builtin_real)
+ {
+ if (kind == 4)
+ return parse_f_type (pstate)->builtin_real;
+ else if (kind == 8)
+ return parse_f_type (pstate)->builtin_real_s8;
+ else if (kind == 16)
+ return parse_f_type (pstate)->builtin_real_s16;
+ }
+ else if (basetype == parse_f_type (pstate)->builtin_logical)
+ {
+ if (kind == 1)
+ return parse_f_type (pstate)->builtin_logical_s1;
+ else if (kind == 2)
+ return parse_f_type (pstate)->builtin_logical_s2;
+ else if (kind == 4)
+ return parse_f_type (pstate)->builtin_logical;
+ else if (kind == 8)
+ return parse_f_type (pstate)->builtin_logical_s8;
+ }
+ else if (basetype == parse_f_type (pstate)->builtin_integer)
+ {
+ if (kind == 2)
+ return parse_f_type (pstate)->builtin_integer_s2;
+ else if (kind == 4)
+ return parse_f_type (pstate)->builtin_integer;
+ }
error (_("unsupported kind %d for type %s"),
kind, TYPE_SAFE_NAME (basetype));