aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.fortran
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/testsuite/gdb.fortran')
-rw-r--r--gdb/testsuite/gdb.fortran/derived-type.exp35
-rw-r--r--gdb/testsuite/gdb.fortran/derived-type.f907
2 files changed, 39 insertions, 3 deletions
diff --git a/gdb/testsuite/gdb.fortran/derived-type.exp b/gdb/testsuite/gdb.fortran/derived-type.exp
index 32431bc..2781850 100644
--- a/gdb/testsuite/gdb.fortran/derived-type.exp
+++ b/gdb/testsuite/gdb.fortran/derived-type.exp
@@ -73,14 +73,45 @@ gdb_test_multiple $test $test {
gdb_test "print q%x%c" "\\$\[0-9\]+ = 1"
gdb_test "print q%x%d" "\\$\[0-9\]+ = 2\\.375"
+set result_line "= \\( a = 3.125, x = \\( c = 1, d = 2\\.375 \\),\
+b = 'abcdefg' \\)\r\n$gdb_prompt $"
+
+# Used in case compiler generates an array of characters.
+set result_line_2 " = \\( a = 3.125, x = \\( 1, 2\\.375 \\),\
+b = \\('abcdefg'\\) \\)\r\n$gdb_prompt $"
+
set test "print q"
gdb_test_multiple $test $test {
- -re "\\$\[0-9\]+ = \\( a = 3.125, x = \\( c = 1, d = 2\\.375 \\), b = 'abcdefg' \\)\r\n$gdb_prompt $" {
+ -re $result_line {
pass $test
}
- -re "\\$\[0-9\]+ = \\( a = 3.125, x = \\( 1, 2\\.375 \\), b = \\('abcdefg'\\) \\)\r\n$gdb_prompt $" {
+ -re $result_line_2 {
# Compiler should produce string, not an array of characters.
setup_xfail "*-*-*"
fail $test
}
}
+
+gdb_test "print this%a" " = 3\\.125"
+
+set test "print this%b"
+gdb_test_multiple $test $test {
+ -re " = 'abcdefg'\r\n$gdb_prompt $" {
+ pass $test
+ }
+ -re $result_line_2 {
+ setup_xfail "*-*-*"
+ fail $test
+ }
+}
+
+set test "print this"
+gdb_test_multiple $test $test {
+ -re $result_line {
+ pass $test
+ }
+ -re $result_line_2 {
+ setup_xfail "*-*-*"
+ fail $test
+ }
+}
diff --git a/gdb/testsuite/gdb.fortran/derived-type.f90 b/gdb/testsuite/gdb.fortran/derived-type.f90
index 2cb2339..aad1553 100644
--- a/gdb/testsuite/gdb.fortran/derived-type.f90
+++ b/gdb/testsuite/gdb.fortran/derived-type.f90
@@ -29,12 +29,17 @@ program main
end type foo
type(foo) :: q
type(bar) :: p
+ type(foo) :: this
p = bar(1, 2.375)
q%a = 3.125
q%b = "abcdefg"
q%x%c = 1
q%x%d = 2.375
- print *,p,q
+ this%a = 3.125
+ this%b = "abcdefg"
+ this%x%c = 1
+ this%x%d = 2.375
+ print *,p,q,this
end program main