public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Nils-Christian Kempke <nils-christian.kempke@intel.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 05/11] gdb/fortran: change default logical type to builtin_logical
Date: Wed,  9 Mar 2022 11:39:16 +0100	[thread overview]
Message-ID: <20220309103922.3257803-6-nils-christian.kempke@intel.com> (raw)
In-Reply-To: <20220309103922.3257803-1-nils-christian.kempke@intel.com>

According to the Fortran standard, logical is of the size of a
'single numeric storage unit' (just like real and integer). For
gfortran, flang and ifx/ifort this storage unit (or the default
logical type) is of size kind 4, actually occupying 4 bytes of
storage, and so the default type for logical expressions in
Fortran should probably also be Logical*4 and not Logical*2.  I
adapted GDB's behavior to be in line with
gfortran/ifort/ifx/flang.

gdb/ChangeLog:
2022-02-22  Nils-Christian Kempke  <nils-christian.kempke@intel.com>

	* f-lang.c: Change Fortran default logical to builtin_logical.

gdb/testsuite/ChangeLog:
2022-02-22  Nils-Christian Kempke  <nils-christian.kempke@intel.com>

	* gdb.fortran/types.exp: Adapt expected output.

Signed-off-by: Nils-Christian Kempke <nils-christian.kempke@intel.com>
---
 gdb/f-lang.c                        | 2 +-
 gdb/testsuite/gdb.fortran/types.exp | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/gdb/f-lang.c b/gdb/f-lang.c
index c8a0d66877..8e9af7661c 100644
--- a/gdb/f-lang.c
+++ b/gdb/f-lang.c
@@ -1570,7 +1570,7 @@ f_language::language_arch_info (struct gdbarch *gdbarch,
   add (builtin->builtin_void);
 
   lai->set_string_char_type (builtin->builtin_character);
-  lai->set_bool_type (builtin->builtin_logical_s2, "logical");
+  lai->set_bool_type (builtin->builtin_logical, "logical");
 }
 
 /* See language.h.  */
diff --git a/gdb/testsuite/gdb.fortran/types.exp b/gdb/testsuite/gdb.fortran/types.exp
index 4205d308be..8122cbcca3 100644
--- a/gdb/testsuite/gdb.fortran/types.exp
+++ b/gdb/testsuite/gdb.fortran/types.exp
@@ -48,10 +48,10 @@ proc test_logical_literal_types_accepted {} {
     # Test the only possible values for a logical, TRUE and FALSE (and
     # also true and false).
 
-    gdb_test "pt .TRUE." "type = logical\\*2"
-    gdb_test "pt .FALSE." "type = logical\\*2"
-    gdb_test "pt .true." "type = logical\\*2"
-    gdb_test "pt .false." "type = logical\\*2"
+    gdb_test "pt .TRUE." "type = logical\\*4"
+    gdb_test "pt .FALSE." "type = logical\\*4"
+    gdb_test "pt .true." "type = logical\\*4"
+    gdb_test "pt .false." "type = logical\\*4"
 }
 
 proc test_float_literal_types_accepted {} {
-- 
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


  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 ` [PATCH 01/11] gdb/f-lang: add Integer*1 to Fortran builtin types Nils-Christian Kempke
2022-04-07 14:28   ` 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 ` Nils-Christian Kempke [this message]
2022-04-07 14:32   ` [PATCH 05/11] gdb/fortran: change default logical type to builtin_logical 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-6-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).