diff options
author | Nils-Christian Kempke <nils-christian.kempke@intel.com> | 2022-05-20 17:44:31 +0200 |
---|---|---|
committer | Ijaz, Abdul B <abdul.b.ijaz@intel.com> | 2023-09-08 00:35:18 +0200 |
commit | 85832a8c3c91c8ac39b8c6ef50a4894a55b17ab2 (patch) | |
tree | df601295191cd259d305233e32e2b9af54431c3e /gdb | |
parent | 768c40b5eeb19b1c7e0192e399be960e3b03bb31 (diff) | |
download | binutils-85832a8c3c91c8ac39b8c6ef50a4894a55b17ab2.zip binutils-85832a8c3c91c8ac39b8c6ef50a4894a55b17ab2.tar.gz binutils-85832a8c3c91c8ac39b8c6ef50a4894a55b17ab2.tar.bz2 |
testsuite, fortran: make mixed-lang-stack less compiler dependent
In the gdb.fortran/mixed-lang-stack.exp test when somewhere deep in a
bunch of nested function calls we issue and test a 'info args' command
for the mixed_func_1b function (when in that function's frame).
The signature of the function looks like
subroutine mixed_func_1b(a, b, c, d, e, g)
use type_module
implicit none
integer :: a
real(kind=4) :: b
real(kind=8) :: c
complex(kind=4) :: d
character(len=*) :: e
character(len=:), allocatable :: f
TYPE(MyType) :: g
and usually one would expect arguments a, b, c, d, e, and g to be
emitted here. However, due to some compiler dependent treatment of the
e array the actual output in the test (with gfortran/ifx) is
(gdb) info args
a = 1
b = 2
c = 3
d = (4,5)
e = 'abcdef'
g = ( a = 1.5, b = 2.5 )
_e = 6
where the compiler generated '_e' is emitted as the length of e. While
ifort also generates an additional length argument, the naming (which is
up to the compilers here I think, I could not find anything in the
Fortran standard about this) is different and we see
(gdb) info args
a = 1
b = 2
c = 3
d = (4,5)
e = 'abcdef'
g = ( a = 1.5, b = 2.5 )
.tmp.E.len_V$4a = 6
To make both outputs pass the test, I kept the additional argument for now and
made the regex for the emitted name of the last variable match any
arbitrary name.
Approved-by: Tom Tromey <tom@tromey.com>
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/testsuite/gdb.fortran/mixed-lang-stack.exp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/gdb/testsuite/gdb.fortran/mixed-lang-stack.exp b/gdb/testsuite/gdb.fortran/mixed-lang-stack.exp index 3973f68..20983d6 100644 --- a/gdb/testsuite/gdb.fortran/mixed-lang-stack.exp +++ b/gdb/testsuite/gdb.fortran/mixed-lang-stack.exp @@ -181,6 +181,13 @@ proc run_tests { lang } { set g_val_pattern "\\( a = 1.5, b = 2.5 \\)" } + # The last argument here in info args is compiler generated. It + # contains length of the passed array e (we are in mixed_func_1b here). + # For gfortran and ifx the compilers conveniently named this '_e', + # ifort however prints .tmp.E.len_V$4a. As is seems unreasonable to + # test for an artificially created name and as at the same time all + # 3 tested compilers emit this argument, we only check for its + # existence and its value (6). set args_pattern [multi_line \ "a = 1" \ "b = 2" \ @@ -188,7 +195,7 @@ proc run_tests { lang } { "d = ${d_pattern}" \ "e = ${e_pattern}" \ "g = ${g_val_pattern}" \ - "_e = 6" ] + ".* = 6" ] gdb_test "info args" $args_pattern \ "info args in frame #7" |