]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb/f-lang: add Integer*1 to Fortran builtin types
authorNils-Christian Kempke <nils-christian.kempke@intel.com>
Mon, 11 Apr 2022 12:06:55 +0000 (14:06 +0200)
committerNils-Christian Kempke <nils-christian.kempke@intel.com>
Mon, 11 Apr 2022 12:06:55 +0000 (14:06 +0200)
Add builtin_integer_s1 of size TARGET_CHAR_BIT to Fortran builtin types.

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

index ae5cc4ef1f1d81882f522f094c2c69a11e3384ee..d6103a06e443ef6a777ca401ffc5fec688ec2675 100644 (file)
@@ -1051,7 +1051,9 @@ convert_to_kind_type (struct type *basetype, int kind)
     }
   else if (basetype == parse_f_type (pstate)->builtin_integer)
     {
-      if (kind == 2)
+      if (kind == 1)
+       return parse_f_type (pstate)->builtin_integer_s1;
+      else if (kind == 2)
        return parse_f_type (pstate)->builtin_integer_s2;
       else if (kind == 4)
        return parse_f_type (pstate)->builtin_integer;
index 72dd1363903341d90b304fdf68aa26e10ce942c2..1f95ae817c069b65d2c4f8cfc3b79dac4f721cd2 100644 (file)
@@ -1622,6 +1622,10 @@ build_fortran_types (struct gdbarch *gdbarch)
   builtin_f_type->builtin_logical_s1
     = arch_boolean_type (gdbarch, TARGET_CHAR_BIT, 1, "logical*1");
 
+  builtin_f_type->builtin_integer_s1
+    = arch_integer_type (gdbarch, TARGET_CHAR_BIT, 0,
+                        "integer*1");
+
   builtin_f_type->builtin_integer_s2
     = arch_integer_type (gdbarch, gdbarch_short_bit (gdbarch), 0,
                         "integer*2");
index f92d3b01c78b8cec2ba5c5c26d615c280d4a5134..512325f1a11ee367def2ab9442aa3c8c3d750aee 100644 (file)
@@ -319,6 +319,7 @@ struct builtin_f_type
 {
   struct type *builtin_character;
   struct type *builtin_integer;
+  struct type *builtin_integer_s1;
   struct type *builtin_integer_s2;
   struct type *builtin_integer_s8;
   struct type *builtin_logical;
index b054803a0bf48e5cd656ecea908f821346669639..47b788bf134b1e7e03aecb4fc56e348b83d640b2 100644 (file)
@@ -56,6 +56,7 @@ proc test_basic_parsing_of_type_kinds {} {
     test_cast_1_to_type_kind "logical" "8" "\\.TRUE\\." "8"
 
     test_cast_1_to_type_kind "integer" "" "1" "4"
+    test_cast_1_to_type_kind "integer" "1" "1" "1"
     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"
@@ -92,6 +93,7 @@ proc test_old_star_type_sizes {} {
     gdb_test "p ((logical*4) 1)" " = \\.TRUE\\."
     gdb_test "p ((logical*8) 1)" " = \\.TRUE\\."
 
+    gdb_test "p ((integer*1) 1)" " = 1"
     gdb_test "p ((integer*2) 1)" " = 1"
     gdb_test "p ((integer*4) 1)" " = 1"
     gdb_test "p ((integer*8) 1)" " = 1"
index 7bd51ca63a7bb328468b911a69d804ad07be824c..625e02196adc7af1261734931d0dfb83df174bf7 100644 (file)
@@ -74,7 +74,7 @@ proc test_float_literal_types_accepted {} {
 # Test the the primitive Fortran types, those that GDB should always
 # know, even if the program does not define them, are in fact, known.
 proc test_primitive_types_known {} {
-    foreach type {void character logical*1 integer*2 integer*8 \
+    foreach type {void character logical*1 integer*1 integer*2 integer*8 \
                      logical*2 logical*8 integer logical*4 real \
                      real*8 real*16} {
        gdb_test "ptype $type" [string_to_regexp "type = $type"]