From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7876) id 2C3F93856DD1; Mon, 11 Apr 2022 12:08:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2C3F93856DD1 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Nils-Christian Kempke To: gdb-cvs@sourceware.org Subject: [binutils-gdb] gdb/f-lang: add Integer*1 to Fortran builtin types X-Act-Checkin: binutils-gdb X-Git-Author: Nils-Christian Kempke X-Git-Refname: refs/heads/master X-Git-Oldrev: 04f4c17c7a14ebb6c2212267b2ebc83f1376fe20 X-Git-Newrev: d4c948427dea866c6afb8d9ec7cf1f05dd1c9623 Message-Id: <20220411120834.2C3F93856DD1@sourceware.org> Date: Mon, 11 Apr 2022 12:08:34 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Apr 2022 12:08:34 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Dd4c948427dea= 866c6afb8d9ec7cf1f05dd1c9623 commit d4c948427dea866c6afb8d9ec7cf1f05dd1c9623 Author: Nils-Christian Kempke Date: Mon Apr 11 14:06:55 2022 +0200 gdb/f-lang: add Integer*1 to Fortran builtin types =20 Add builtin_integer_s1 of size TARGET_CHAR_BIT to Fortran builtin types. Diff: --- gdb/f-exp.y | 4 +++- gdb/f-lang.c | 4 ++++ gdb/f-lang.h | 1 + gdb/testsuite/gdb.fortran/type-kinds.exp | 2 ++ gdb/testsuite/gdb.fortran/types.exp | 2 +- 5 files changed, 11 insertions(+), 2 deletions(-) diff --git a/gdb/f-exp.y b/gdb/f-exp.y index ae5cc4ef1f1..d6103a06e44 100644 --- a/gdb/f-exp.y +++ b/gdb/f-exp.y @@ -1051,7 +1051,9 @@ convert_to_kind_type (struct type *basetype, int kind) } else if (basetype =3D=3D parse_f_type (pstate)->builtin_integer) { - if (kind =3D=3D 2) + if (kind =3D=3D 1) + return parse_f_type (pstate)->builtin_integer_s1; + else if (kind =3D=3D 2) return parse_f_type (pstate)->builtin_integer_s2; else if (kind =3D=3D 4) return parse_f_type (pstate)->builtin_integer; diff --git a/gdb/f-lang.c b/gdb/f-lang.c index 72dd1363903..1f95ae817c0 100644 --- a/gdb/f-lang.c +++ b/gdb/f-lang.c @@ -1622,6 +1622,10 @@ build_fortran_types (struct gdbarch *gdbarch) builtin_f_type->builtin_logical_s1 =3D arch_boolean_type (gdbarch, TARGET_CHAR_BIT, 1, "logical*1"); =20 + builtin_f_type->builtin_integer_s1 + =3D arch_integer_type (gdbarch, TARGET_CHAR_BIT, 0, + "integer*1"); + builtin_f_type->builtin_integer_s2 =3D arch_integer_type (gdbarch, gdbarch_short_bit (gdbarch), 0, "integer*2"); diff --git a/gdb/f-lang.h b/gdb/f-lang.h index f92d3b01c78..512325f1a11 100644 --- a/gdb/f-lang.h +++ b/gdb/f-lang.h @@ -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; diff --git a/gdb/testsuite/gdb.fortran/type-kinds.exp b/gdb/testsuite/gdb.f= ortran/type-kinds.exp index b054803a0bf..47b788bf134 100644 --- a/gdb/testsuite/gdb.fortran/type-kinds.exp +++ b/gdb/testsuite/gdb.fortran/type-kinds.exp @@ -56,6 +56,7 @@ proc test_basic_parsing_of_type_kinds {} { test_cast_1_to_type_kind "logical" "8" "\\.TRUE\\." "8" =20 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)" " =3D \\.TRUE\\." gdb_test "p ((logical*8) 1)" " =3D \\.TRUE\\." =20 + gdb_test "p ((integer*1) 1)" " =3D 1" gdb_test "p ((integer*2) 1)" " =3D 1" gdb_test "p ((integer*4) 1)" " =3D 1" gdb_test "p ((integer*8) 1)" " =3D 1" diff --git a/gdb/testsuite/gdb.fortran/types.exp b/gdb/testsuite/gdb.fortra= n/types.exp index 7bd51ca63a7..625e02196ad 100644 --- a/gdb/testsuite/gdb.fortran/types.exp +++ b/gdb/testsuite/gdb.fortran/types.exp @@ -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 =3D $type"]