This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] gdb/fortran: Handle older TYPE*SIZE typenames


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=efbecbc143f19cb308ae220fb386505f41ff4bc3

commit efbecbc143f19cb308ae220fb386505f41ff4bc3
Author: Andrew Burgess <andrew.burgess@embecosm.com>
Date:   Mon Jan 21 15:10:55 2019 +0000

    gdb/fortran: Handle older TYPE*SIZE typenames
    
    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.

Diff:
---
 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/ChangeLog b/gdb/ChangeLog
index 1dbec5a..8866756 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,4 +1,8 @@
 2019-03-06  Andrew Burgess  <andrew.burgess@embecosm.com>
+
+	* f-exp.y (direct_abs_decl): Handle TYPE*SIZE type names.
+
+2019-03-06  Andrew Burgess  <andrew.burgess@embecosm.com>
 	    Chris January  <chris.january@arm.com>
 	    David Lecomber  <david.lecomber@arm.com>
 
diff --git a/gdb/f-exp.y b/gdb/f-exp.y
index 88c685a..7e838b0 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/ChangeLog b/gdb/testsuite/ChangeLog
index 7f70b48..57f80b4 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,9 @@
 2019-03-06  Andrew Burgess  <andrew.burgess@embecosm.com>
 
+	* gdb.fortran/type-kinds.exp: Extend to cover TYPE*SIZE cases.
+
+2019-03-06  Andrew Burgess  <andrew.burgess@embecosm.com>
+
 	* gdb.fortran/intrinsics.exp: Extend to cover ABS.
 
 2019-03-06  Andrew Burgess  <andrew.burgess@embecosm.com>
diff --git a/gdb/testsuite/gdb.fortran/type-kinds.exp b/gdb/testsuite/gdb.fortran/type-kinds.exp
index b5d4e7b..1ae15b9 100644
--- a/gdb/testsuite/gdb.fortran/type-kinds.exp
+++ b/gdb/testsuite/gdb.fortran/type-kinds.exp
@@ -65,11 +65,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
 }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]