aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2021-07-06 17:04:14 +0200
committerTom de Vries <tdevries@suse.de>2021-07-06 17:04:14 +0200
commit52e44e8d29bf3b3d0bef74c8b25dd21f053a9eb9 (patch)
treef5cfe618363d94ea0ac0effa5c0aafa771f150b7 /gdb/testsuite
parent5354f52ba23dd2702e5d6ee75a886fd89a468a02 (diff)
downloadgdb-52e44e8d29bf3b3d0bef74c8b25dd21f053a9eb9.zip
gdb-52e44e8d29bf3b3d0bef74c8b25dd21f053a9eb9.tar.gz
gdb-52e44e8d29bf3b3d0bef74c8b25dd21f053a9eb9.tar.bz2
[gdb/testsuite] Fix fail in gdb.fortran/ptype-on-functions.exp with gcc-7
Since commit 05b85772061 "gdb/fortran: Add type info of formal parameter for clang" I see: ... (gdb) ptype say_string^M type = void (character*(*), integer(kind=4))^M (gdb) FAIL: gdb.fortran/ptype-on-functions.exp: ptype say_string ... The part of the commit causing the fail is: ... gdb_test "ptype say_string" \ - "type = void \\(character\\*\\(\\*\\), integer\\(kind=\\d+\\)\\)" + "type = void \\(character\[^,\]+, $integer8\\)" ... which fails to take into account that for gcc-7 and before, the type for string length of a string argument is int, not size_t. Fix this by allowing both $integer8 and $integer4. Tested on x86_64-linux, with gcc-7 and gcc-10. gdb/testsuite/ChangeLog: 2021-07-06 Tom de Vries <tdevries@suse.de> * gdb.fortran/ptype-on-functions.exp: Allow both $integer8 and $integer4 for size of string length.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r--gdb/testsuite/ChangeLog5
-rw-r--r--gdb/testsuite/gdb.fortran/ptype-on-functions.exp9
2 files changed, 13 insertions, 1 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 67fa42c..37c092e 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2021-07-06 Tom de Vries <tdevries@suse.de>
+
+ * gdb.fortran/ptype-on-functions.exp: Allow both $integer8 and
+ $integer4 for size of string length.
+
2021-07-01 Pedro Alves <pedro@palves.net>
PR mi/15729
diff --git a/gdb/testsuite/gdb.fortran/ptype-on-functions.exp b/gdb/testsuite/gdb.fortran/ptype-on-functions.exp
index 7519795..7d11967 100644
--- a/gdb/testsuite/gdb.fortran/ptype-on-functions.exp
+++ b/gdb/testsuite/gdb.fortran/ptype-on-functions.exp
@@ -33,6 +33,13 @@ set integer4 [fortran_int4]
set logical4 [fortran_logical4]
set integer8 [fortran_int8]
+# A fortran string parameter is passed as a char *, and an additional
+# argument str_ for the string length. The type used for the string length
+# argument is size_t, but for gcc 7 and earlier, the actual type is int
+# instead ( see
+# https://gcc.gnu.org/onlinedocs/gfortran/Argument-passing-conventions.html ).
+set stringlen ($integer8|$integer4)
+
if {[test_compiler_info {clang-*}]} {
set some_module_class_type "Type number"
set some_module_aux_info ", $integer8 \\(10\\)"
@@ -62,7 +69,7 @@ gdb_test "ptype fun_ptr" \
"type = PTR TO -> \\( $integer4 \\(\\) \\(${fun_ptr_arg}\\) \\)"
gdb_test "ptype say_string" \
- "type = void \\(character\[^,\]+, $integer8\\)"
+ "type = void \\(character\[^,\]+, $stringlen\\)"
set say_array_artificial_first_arg ""
if {[test_compiler_info {clang-*}]} {