aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2019-12-03 10:52:05 +0000
committerAndrew Burgess <andrew.burgess@embecosm.com>2019-12-04 20:29:53 +0000
commit36c8fb93c9d4135ce3c1561f5f3886b1b0bf31f6 (patch)
treecc79ca29a04f21c9712ba4b9121170ddfdb84aab /gdb/testsuite
parentc6170c2c141866bc3fd158db17a1e0b87b43ef07 (diff)
downloadgdb-36c8fb93c9d4135ce3c1561f5f3886b1b0bf31f6.zip
gdb-36c8fb93c9d4135ce3c1561f5f3886b1b0bf31f6.tar.gz
gdb-36c8fb93c9d4135ce3c1561f5f3886b1b0bf31f6.tar.bz2
gdb/fortran: Support for single/double type modifiers
Extend the Fortran parser to support 'single precision' and 'double precision' types as well 'single complex' and 'double complex' types. gdb/ChangeLog: * f-exp.y (COMPLEX_KEYWORD, SINGLE, DOUBLE, PRECISION): New tokens. (typebase): New patterns for complex, single/double precision, and single/double complex. (f77_keywords): Change token for complex keyword, and add single, double, and precision keywords. gdb/testsuite/ChangeLog: * gdb.fortran/type-kinds.exp (test_cast_1_to_type_kind): Handle casting to type with no kind specified. (test_basic_parsing_of_type_kinds): Additional tests for types with no kind specified, and add tests for single/double precision/complex types. Change-Id: I9c82f4d392c58607747bd08862c1ee330723a1ba
Diffstat (limited to 'gdb/testsuite')
-rw-r--r--gdb/testsuite/ChangeLog8
-rw-r--r--gdb/testsuite/gdb.fortran/type-kinds.exp20
2 files changed, 26 insertions, 2 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 2d45592..8df282c 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2019-12-04 Andrew Burgess <andrew.burgess@embecosm.com>
+
+ * gdb.fortran/type-kinds.exp (test_cast_1_to_type_kind): Handle
+ casting to type with no kind specified.
+ (test_basic_parsing_of_type_kinds): Additional tests for types
+ with no kind specified, and add tests for single/double
+ precision/complex types.
+
2019-12-04 Tom Tromey <tromey@adacore.com>
* gdb.base/endianity.c (struct other) <x>: New field.
diff --git a/gdb/testsuite/gdb.fortran/type-kinds.exp b/gdb/testsuite/gdb.fortran/type-kinds.exp
index 9d19a9c..725c3f0 100644
--- a/gdb/testsuite/gdb.fortran/type-kinds.exp
+++ b/gdb/testsuite/gdb.fortran/type-kinds.exp
@@ -23,9 +23,15 @@ if { [skip_fortran_tests] } { continue }
# Cast the value 1 to the type 'BASE_TYPE (kind=TYPE_KIND)'. The
# expected result of the cast is CAST_RESULT, and the size of the
-# value returned by the cast should be SIZE_RESULT.
+# value returned by the cast should be SIZE_RESULT. If TYPE_KIND is
+# the empty string then the cast is done to just 'BASE_TYPE'.
proc test_cast_1_to_type_kind {base_type type_kind cast_result size_result} {
- set type_string "$base_type (kind=$type_kind)"
+ if { $type_kind != "" } {
+ set kind_string " (kind=$type_kind)"
+ } else {
+ set kind_string ""
+ }
+ set type_string "${base_type}${kind_string}"
gdb_test "p (($type_string) 1)" " = $cast_result"
gdb_test "p sizeof (($type_string) 1)" " = $size_result"
}
@@ -34,21 +40,31 @@ proc test_cast_1_to_type_kind {base_type type_kind cast_result size_result} {
proc test_basic_parsing_of_type_kinds {} {
test_cast_1_to_type_kind "character" "1" "1 '\\\\001'" "1"
+ test_cast_1_to_type_kind "complex" "" "\\(1,0\\)" "8"
test_cast_1_to_type_kind "complex" "4" "\\(1,0\\)" "8"
test_cast_1_to_type_kind "complex" "8" "\\(1,0\\)" "16"
test_cast_1_to_type_kind "complex" "16" "\\(1,0\\)" "32"
+ test_cast_1_to_type_kind "real" "" "1" "4"
test_cast_1_to_type_kind "real" "4" "1" "4"
test_cast_1_to_type_kind "real" "8" "1" "8"
test_cast_1_to_type_kind "real" "16" "1" "16"
+ test_cast_1_to_type_kind "logical" "" "\\.TRUE\\." "4"
test_cast_1_to_type_kind "logical" "1" "\\.TRUE\\." "1"
test_cast_1_to_type_kind "logical" "4" "\\.TRUE\\." "4"
test_cast_1_to_type_kind "logical" "8" "\\.TRUE\\." "8"
+ test_cast_1_to_type_kind "integer" "" "1" "4"
test_cast_1_to_type_kind "integer" "2" "1" "2"
test_cast_1_to_type_kind "integer" "4" "1" "4"
test_cast_1_to_type_kind "integer" "8" "1" "8"
+
+ test_cast_1_to_type_kind "double precision" "" "1" "8"
+ test_cast_1_to_type_kind "single precision" "" "1" "4"
+
+ test_cast_1_to_type_kind "double complex" "" "\\(1,0\\)" "16"
+ test_cast_1_to_type_kind "single complex" "" "\\(1,0\\)" "8"
}
proc test_parsing_invalid_type_kinds {} {