public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] gdb/fortran: change default logical type to builtin_logical
@ 2022-04-11 12:08 Nils-Christian Kempke
0 siblings, 0 replies; only message in thread
From: Nils-Christian Kempke @ 2022-04-11 12:08 UTC (permalink / raw)
To: gdb-cvs
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=4ec8aa9e94858144a4ca831ae810d741a172d4b7
commit 4ec8aa9e94858144a4ca831ae810d741a172d4b7
Author: Nils-Christian Kempke <nils-christian.kempke@intel.com>
Date: Mon Apr 11 14:06:55 2022 +0200
gdb/fortran: change default logical type to builtin_logical
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.
Diff:
---
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 80846244dfb..fb28cb7a561 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 4205d308be7..8122cbcca38 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 {} {
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-04-11 12:08 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-11 12:08 [binutils-gdb] gdb/fortran: change default logical type to builtin_logical Nils-Christian Kempke
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).