public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Andrew Burgess <andrew.burgess@embecosm.com>
To: gdb-patches@sourceware.org
Cc: Richard Bunt <Richard.Bunt@arm.com>,
	Andrew Burgess <andrew.burgess@embecosm.com>
Subject: [PATCH 11/11] gdb/fortran: Handle older TYPE*SIZE typenames
Date: Tue, 12 Feb 2019 16:11:00 -0000	[thread overview]
Message-ID: <6ca66dbf3679496540ac7892963b75aed9756a3c.1549986233.git.andrew.burgess@embecosm.com> (raw)
In-Reply-To: <cover.1549986233.git.andrew.burgess@embecosm.com>
In-Reply-To: <cover.1549986233.git.andrew.burgess@embecosm.com>

This patch adds support for the older TYPE*SIZE typenames that are
still around in older code.

For implementation this currently reuses the kind mechanism, as under
gFortran the kind number is equivalent to the size, however, this is
not necessarily true for all compilers.  If the rules for other
compilers are better understood then this code might need to be
improved slightly to allow for a distinction between size and kind,
however, adding this extra complexity now seems pointless.

gdb/ChangeLog:

	* f-exp.y (direct_abs_decl): Handle TYPE*SIZE type names.

gdb/testsuite/ChangeLog:

	* gdb.fortran/type-kinds.exp: Extend to cover TYPE*SIZE cases.
---
 gdb/ChangeLog                            |  4 ++++
 gdb/f-exp.y                              |  2 ++
 gdb/testsuite/ChangeLog                  |  4 ++++
 gdb/testsuite/gdb.fortran/type-kinds.exp | 23 +++++++++++++++++++++++
 4 files changed, 33 insertions(+)

diff --git a/gdb/f-exp.y b/gdb/f-exp.y
index 88c685a0af3..7e838b0a93a 100644
--- a/gdb/f-exp.y
+++ b/gdb/f-exp.y
@@ -570,6 +570,8 @@ direct_abs_decl: '(' abs_decl ')'
 			{ $$ = $2; }
 	| 	'(' KIND '=' INT ')'
 			{ push_kind_type ($4.val, $4.type); }
+	|	'*' INT
+			{ push_kind_type ($2.val, $2.type); }
 	| 	direct_abs_decl func_mod
 			{ push_type (tp_function); }
 	|	func_mod
diff --git a/gdb/testsuite/gdb.fortran/type-kinds.exp b/gdb/testsuite/gdb.fortran/type-kinds.exp
index 0daa1ec6b12..291749a1541 100644
--- a/gdb/testsuite/gdb.fortran/type-kinds.exp
+++ b/gdb/testsuite/gdb.fortran/type-kinds.exp
@@ -50,11 +50,34 @@ proc test_parsing_invalid_type_kinds {} {
     }
 }
 
+# Perform some basic checks that GDB can parse the older style
+# TYPE*SIZE type names.
+proc test_old_star_type_sizes {} {
+    gdb_test "p ((character*1) 1)" " = 1 '\\\\001'"
+
+    gdb_test "p ((complex*4) 1)" " = \\(1,0\\)"
+    gdb_test "p ((complex*8) 1)" " = \\(1,0\\)"
+    gdb_test "p ((complex*16) 1)" " = \\(1,0\\)"
+
+    gdb_test "p ((real*4) 1)" " = 1"
+    gdb_test "p ((real*8) 1)" " = 1"
+    gdb_test "p ((real*16) 1)" " = 1"
+
+    gdb_test "p ((logical*1) 1)" " = \\.TRUE\\."
+    gdb_test "p ((logical*4) 1)" " = \\.TRUE\\."
+    gdb_test "p ((logical*8) 1)" " = \\.TRUE\\."
+
+    gdb_test "p ((integer*2) 1)" " = 1"
+    gdb_test "p ((integer*4) 1)" " = 1"
+    gdb_test "p ((integer*8) 1)" " = 1"
+}
+
 clean_restart
 
 if [set_lang_fortran] then {
     test_basic_parsing_of_type_kinds
     test_parsing_invalid_type_kinds
+    test_old_star_type_sizes
 } else {
     warning "$test_name tests suppressed." 0
 }
-- 
2.14.5

  reply	other threads:[~2019-02-12 16:11 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-12 16:11 [PATCH 00/11] Fortran Parser Cleanup, KIND Support, and Intrinsic Functions Andrew Burgess
2019-02-12 16:11 ` Andrew Burgess [this message]
2019-02-12 16:11 ` [PATCH 07/11] gdb/fortran: Expand the set of types that support (kind=N) Andrew Burgess
2019-02-12 16:11 ` [PATCH 05/11] gdb/fortran: Enable debugging of the Fortran parser Andrew Burgess
2019-02-12 16:11 ` [PATCH 04/11] gdb/fortran: Add new function to evaluate Fortran expressions Andrew Burgess
2019-02-12 16:11 ` [PATCH 09/11] gdb/fortran: Use TYPE_CODE_CHAR for character types Andrew Burgess
2019-02-12 16:11 ` [PATCH 06/11] gdb/fortran: Add Fortran 'kind' intrinsic and keyword Andrew Burgess
2019-02-12 16:11 ` [PATCH 01/11] gdb/fortran: Remove some duplicate tests Andrew Burgess
2019-02-12 16:11 ` [PATCH 03/11] gdb/fortran: Simplify handling of Fortran dot operations and keywords Andrew Burgess
2019-02-12 16:11 ` [PATCH 10/11] gdb/fortran: Add support for the ABS intrinsic function Andrew Burgess
2019-02-12 16:11 ` [PATCH 08/11] gdb/fortran: Add builtin 8-byte integer type with (kind=8) support Andrew Burgess
2019-02-12 16:11 ` [PATCH 02/11] gdb/fortran: Cleanup code for parsing logical constants Andrew Burgess
2019-03-06 18:15 ` [PUSHED " Andrew Burgess
2019-03-06 18:15 ` [PUSHED 01/11] gdb/fortran: Remove some duplicate tests Andrew Burgess
2019-03-06 18:15 ` [PUSHED 04/11] gdb/fortran: Add new function to evaluate Fortran expressions Andrew Burgess
2019-03-06 18:15 ` [PUSHED 00/11] Fortran Parser Cleanup, KIND Support, and Intrinsic Functions Andrew Burgess
2019-03-06 18:16 ` [PUSHED 11/11] gdb/fortran: Handle older TYPE*SIZE typenames Andrew Burgess
2019-03-06 18:16 ` [PUSHED 06/11] gdb/fortran: Add Fortran 'kind' intrinsic and keyword Andrew Burgess
2019-03-06 18:16 ` [PUSHED 08/11] gdb/fortran: Add builtin 8-byte integer type with (kind=8) support Andrew Burgess
2019-03-06 18:16 ` [PUSHED 10/11] gdb/fortran: Add support for the ABS intrinsic function Andrew Burgess
2019-03-06 19:11   ` Tom Tromey
2019-03-07 15:23     ` [PATCH] gdb: Move value_from_host_double into value.c and make more use of it Andrew Burgess
2019-03-07 15:49       ` Tom Tromey
2019-03-06 18:16 ` [PUSHED 03/11] gdb/fortran: Simplify handling of Fortran dot operations and keywords Andrew Burgess
2019-03-06 18:16 ` [PUSHED 07/11] gdb/fortran: Expand the set of types that support (kind=N) Andrew Burgess
2019-03-06 18:16 ` [PUSHED 05/11] gdb/fortran: Enable debugging of the Fortran parser Andrew Burgess
2019-03-06 18:16 ` [PUSHED 09/11] gdb/fortran: Use TYPE_CODE_CHAR for character types Andrew Burgess

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=6ca66dbf3679496540ac7892963b75aed9756a3c.1549986233.git.andrew.burgess@embecosm.com \
    --to=andrew.burgess@embecosm.com \
    --cc=Richard.Bunt@arm.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).