diff options
author | Nils-Christian Kempke <nils-christian.kempke@intel.com> | 2022-04-11 14:06:55 +0200 |
---|---|---|
committer | Nils-Christian Kempke <nils-christian.kempke@intel.com> | 2022-04-11 14:06:55 +0200 |
commit | 4e436fdabe216b5684b4efb6978843b2380fe32a (patch) | |
tree | fab532fa29c1587a0c280189d377f0b8ed333055 /gdb/testsuite | |
parent | c08ec64081d95b7a9abf35e54efaf44051aea195 (diff) | |
download | gdb-4e436fdabe216b5684b4efb6978843b2380fe32a.zip gdb-4e436fdabe216b5684b4efb6978843b2380fe32a.tar.gz gdb-4e436fdabe216b5684b4efb6978843b2380fe32a.tar.bz2 |
gdb/fortran: fix complex type in Fortran builtin types
Before this patch things like
(gdb) ptype complex*8
complex*16
(gdb) ptype complex*4
complex*8
were possible in GDB, which seems confusing for a user. The reason
is a mixup in the implementation of the Fortran COMPLEX type. In
Fortran the "*X" after a type would normally (I don't think this
is language required) specify the type's size in memory. For the
COMPLEX type the kind parameters usually (at least for GNU, Intel, Flang)
specify not the size of the whole type but the size of the individual
two REALs used to form the COMPLEX. Thus, a COMPLEX*4 will usually
consist of two REAL*4s. Internally this type was represented by a
builtin_complex_s8 - but here I think the s8 actually meant the raw
size of the type. This is confusing and I renamed the types (e.g.
builting_complex_s8 became builtin_complex_s4 according to its most
common useage) and their printed names to their language equivalent.
Additionally, I added the default COMPLEX type "COMPLEX" being the same
as a COMPLEX*4 (as is normally the case) and removed the latter. I added
a few tests for this new behavior as well.
The new behavior is
(gdb) ptype complex*8
complex*8
(gdb) ptype complex*4
complex*4
Diffstat (limited to 'gdb/testsuite')
-rw-r--r-- | gdb/testsuite/gdb.fortran/types.exp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/gdb/testsuite/gdb.fortran/types.exp b/gdb/testsuite/gdb.fortran/types.exp index 625e021..4205d30 100644 --- a/gdb/testsuite/gdb.fortran/types.exp +++ b/gdb/testsuite/gdb.fortran/types.exp @@ -76,7 +76,7 @@ proc test_float_literal_types_accepted {} { proc test_primitive_types_known {} { foreach type {void character logical*1 integer*1 integer*2 integer*8 \ logical*2 logical*8 integer logical*4 real \ - real*8 real*16} { + real*8 real*16 complex*4 complex*8 complex*16} { gdb_test "ptype $type" [string_to_regexp "type = $type"] } } |