gdb/fortran: Handle older TYPE*SIZE typenames
authorAndrew Burgess <andrew.burgess@embecosm.com>
Mon, 21 Jan 2019 15:10:55 +0000 (15:10 +0000)
committerAndrew Burgess <andrew.burgess@embecosm.com>
Wed, 6 Mar 2019 18:11:31 +0000 (18:11 +0000)
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
gdb/f-exp.y
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.fortran/type-kinds.exp

index 1dbec5aeffab65d3eec17f25bd7451d74f794bfe..8866756ff04e3bd0fbf27bc82aaf5d43e55c4000 100644 (file)
@@ -1,3 +1,7 @@
+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>
index 88c685a0af35bd27e5664e8a5d1d175c8d16b426..7e838b0a93a459b931ed41808692217b215ad71d 100644 (file)
@@ -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
index 7f70b489390fab81325aa03bd8a0d753c5036dbd..57f80b49b59c7caed79af50b8861c72d9cf22340 100644 (file)
@@ -1,3 +1,7 @@
+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.
index b5d4e7b5816e6c19b0f35278ae79666b65a4089a..1ae15b96f1aa366ee53b746a5f707983dbc2bb19 100644 (file)
@@ -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
 }
This page took 0.032269 seconds and 4 git commands to generate.