gdb/fortran: Add builtin 8-byte integer type with (kind=8) support
authorAndrew Burgess <andrew.burgess@embecosm.com>
Thu, 17 Jan 2019 16:31:56 +0000 (16:31 +0000)
committerAndrew Burgess <andrew.burgess@embecosm.com>
Wed, 6 Mar 2019 18:11:31 +0000 (18:11 +0000)
Add a new builtin type, an 8-byte integer, and allow GDB to parse
'integer (kind=8)', returning the new 8-byte integer.

gdb/ChangeLog:

* f-exp.y (convert_to_kind_type): Handle integer (kind=8).
* f-lang.c (build_fortran_types): Setup builtin_integer_s8.
* f-lang.h (struct builtin_f_type): Add builtin_integer_s8 field.

gdb/testsuite/ChangeLog:

* gdb.fortran/type-kinds.exp: Test new integer type kind.

gdb/ChangeLog
gdb/f-exp.y
gdb/f-lang.c
gdb/f-lang.h
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.fortran/type-kinds.exp

index be7b96b132d773c9861b502af3bd614a2e40b7a7..b0d0edb22c669db28e12b36379c5616aa0831ccf 100644 (file)
@@ -1,3 +1,9 @@
+2019-03-06  Andrew Burgess  <andrew.burgess@embecosm.com>
+
+       * f-exp.y (convert_to_kind_type): Handle integer (kind=8).
+       * f-lang.c (build_fortran_types): Setup builtin_integer_s8.
+       * f-lang.h (struct builtin_f_type): Add builtin_integer_s8 field.
+
 2019-03-06  Andrew Burgess  <andrew.burgess@embecosm.com>
 
        * f-exp.y (convert_to_kind_type): Handle more type kinds.
index 980ee4b4adbb7af233785e3ae5b24ae6947067e4..d256ff14c1e8a590909bf4041831d6997b807bc5 100644 (file)
@@ -865,6 +865,8 @@ convert_to_kind_type (struct type *basetype, int kind)
        return parse_f_type (pstate)->builtin_integer_s2;
       else if (kind == 4)
        return parse_f_type (pstate)->builtin_integer;
+      else if (kind == 8)
+       return parse_f_type (pstate)->builtin_integer_s8;
     }
 
   error (_("unsupported kind %d for type %s"),
index 34ebfd9de6b1803d474ee441660b7e4d3be2979b..f27eb0d45da1bf7a890d8b369774d1eb22170431 100644 (file)
@@ -375,6 +375,10 @@ build_fortran_types (struct gdbarch *gdbarch)
     = arch_integer_type (gdbarch, gdbarch_short_bit (gdbarch), 0,
                         "integer*2");
 
+  builtin_f_type->builtin_integer_s8
+    = arch_integer_type (gdbarch, gdbarch_long_long_bit (gdbarch), 0,
+                        "integer*8");
+
   builtin_f_type->builtin_logical_s2
     = arch_boolean_type (gdbarch, gdbarch_short_bit (gdbarch), 1,
                         "logical*2");
index 5afafb1a051716700c9c4fb73c128afb09333fa7..746c11fd9f19fd7782a139cbfa1e9399101ccd94 100644 (file)
@@ -66,6 +66,7 @@ struct builtin_f_type
   struct type *builtin_character;
   struct type *builtin_integer;
   struct type *builtin_integer_s2;
+  struct type *builtin_integer_s8;
   struct type *builtin_logical;
   struct type *builtin_logical_s1;
   struct type *builtin_logical_s2;
index a4411652b74eca0ac438e50998567ee3dc50ad10..b5599e473e7319d43a6f66b4ddb16bf74d73fbc8 100644 (file)
@@ -1,3 +1,7 @@
+2019-03-06  Andrew Burgess  <andrew.burgess@embecosm.com>
+
+       * gdb.fortran/type-kinds.exp: Test new integer type kind.
+
 2019-03-06  Andrew Burgess  <andrew.burgess@embecosm.com>
 
        * gdb.fortran/type-kinds.exp (test_cast_1_to_type_kind): New
index c679bc504f97c3d01ad4b9ea8739de45366bf274..198ac58baf48b9e3fa209f5605f433091565e82c 100644 (file)
@@ -54,6 +54,7 @@ proc test_basic_parsing_of_type_kinds {} {
 
     test_cast_1_to_type_kind "integer" "2" "1" "2"
     test_cast_1_to_type_kind "integer" "4" "1" "4"
+    test_cast_1_to_type_kind "integer" "8" "1" "8"
 }
 
 proc test_parsing_invalid_type_kinds {} {