From: Nils-Christian Kempke <nils-christian.kempke@intel.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 01/11] gdb/f-lang: add Integer*1 to Fortran builtin types
Date: Wed, 9 Mar 2022 11:39:12 +0100 [thread overview]
Message-ID: <20220309103922.3257803-2-nils-christian.kempke@intel.com> (raw)
In-Reply-To: <20220309103922.3257803-1-nils-christian.kempke@intel.com>
Add builtin_integer_s1 of size TARGET_CHAR_BIT to Fortran builtin types.
gdb/ChangeLog:
2022-01-22 Nils-Christian Kempke <nils-christian.kempke@intel.com>
* f-exp.y (convert_to_kind_type): Add kind one for integer and
map to builtin_integer_s1.
* f-lang.h (builtin_f_type): Add builtin_integer_s1.
* f-lang.c (build_fortran_types): Initalize builtin_integer_s1
with TARGET_CHAR_BIT.
gdb/testsuite/ChangeLog:
2022-01-22 Nils-Christian Kempke <nils-christian.kempke@intel.com>
* gdb.fortran/type-kinds.exp: Add test for Integer*1.
* gdb.fortran/types.exp: Add test for Integer*1.
Signed-off-by: Nils-Christian Kempke <nils-christian.kempke@intel.com>
---
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 9cba30f683..a17d02611b 100644
--- a/gdb/f-exp.y
+++ b/gdb/f-exp.y
@@ -1048,7 +1048,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;
diff --git a/gdb/f-lang.c b/gdb/f-lang.c
index eaeda884ae..5f7a9e868c 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
= 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");
diff --git a/gdb/f-lang.h b/gdb/f-lang.h
index 11debd5569..3631c6620a 100644
--- a/gdb/f-lang.h
+++ b/gdb/f-lang.h
@@ -308,6 +308,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.fortran/type-kinds.exp
index b054803a0b..47b788bf13 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"
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"
diff --git a/gdb/testsuite/gdb.fortran/types.exp b/gdb/testsuite/gdb.fortran/types.exp
index 7bd51ca63a..625e02196a 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 = $type"]
--
2.25.1
Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928
next prev parent reply other threads:[~2022-03-09 10:39 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-09 10:39 [PATCH 00/11] Improve Fortran intrinsic types and procedures Nils-Christian Kempke
2022-03-09 10:39 ` Nils-Christian Kempke [this message]
2022-04-07 14:28 ` [PATCH 01/11] gdb/f-lang: add Integer*1 to Fortran builtin types Tom Tromey
2022-03-09 10:39 ` [PATCH 02/11] gdb/f-lang: remove hidden ^L characters Nils-Christian Kempke
2022-04-07 14:28 ` Tom Tromey
2022-03-09 10:39 ` [PATCH 03/11] gdb/fortran: fix complex type in Fortran builtin types Nils-Christian Kempke
2022-04-07 14:30 ` Tom Tromey
2022-03-09 10:39 ` [PATCH 04/11] gdb/fortran: reformat build_fortran_types in f-lang.c Nils-Christian Kempke
2022-04-07 14:30 ` Tom Tromey
2022-03-09 10:39 ` [PATCH 05/11] gdb/fortran: change default logical type to builtin_logical Nils-Christian Kempke
2022-04-07 14:32 ` Tom Tromey
2022-03-09 10:39 ` [PATCH 06/11] gdb/fortran: clean-up Fortran intrinsic types Nils-Christian Kempke
2022-04-07 14:33 ` Tom Tromey
2022-03-09 10:39 ` [PATCH 07/11] gdb/fortran: Change GDB print for fortran default types Nils-Christian Kempke
2022-04-07 14:37 ` Tom Tromey
2022-03-09 10:39 ` [PATCH 08/11] gdb/fortran: rename f77_keywords to f_keywords Nils-Christian Kempke
2022-04-07 14:37 ` Tom Tromey
2022-03-09 10:39 ` [PATCH 09/11] gdb/fortran: rewrite intrinsic handling and add some missing overloads Nils-Christian Kempke
2022-04-07 14:49 ` Tom Tromey
2022-04-08 12:49 ` Kempke, Nils-Christian
2022-04-13 5:14 ` Tom de Vries
2022-04-20 16:10 ` Kempke, Nils-Christian
2022-03-09 10:39 ` [PATCH 10/11] gdb/fortran/testsuite: add complex from integers test Nils-Christian Kempke
2022-04-07 14:49 ` Tom Tromey
2022-04-07 14:50 ` Tom Tromey
2022-03-09 10:39 ` [PATCH 11/11] gdb/doc: add section about fortran intrinsic functions and types Nils-Christian Kempke
2022-03-09 12:49 ` Eli Zaretskii
2022-03-09 17:01 ` Kempke, Nils-Christian
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220309103922.3257803-2-nils-christian.kempke@intel.com \
--to=nils-christian.kempke@intel.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).