[PATCH 08/18] testsuite, fortran: make print-formatted.exp more robust
Andrew Burgess
aburgess@redhat.com
Wed May 11 11:32:27 GMT 2022
Nils-Christian Kempke via Gdb-patches <gdb-patches@sourceware.org>
writes:
> The test was written in a way that assumed, that going to main and
> issuing a single next command would automatically end up after the
> assign statement for ii. This was true for gfortran and ifort, but not
> for ifx leading to a failed test. For ifx, GDB actually was at
> the assign statment (not past it) and printing 'ii' there would lead to
> GDB displaying it as 0 (instead of 10), failing the test.
>
> I changed this to become more robust and added a line past the
> assignment with a comment, as is commonly done all over the testsuite.
>
> After this change the test passes for all, gfortran/ifort/ifx/flang.
I have no problem with this change, the point of the test is clearly the
print formatting rather than the behaviour of 'next'.
That said, isn't the behaviour for ifx indicating a bug in the generated
debug info? The program only has the single 'ii = 10' statement, so
surely when we run to main, that's where we should stop? Then 'next'
should move past that line?
If you agree then it might be worth mentioning that this is working
around the compiler bug.
Thanks,
Andrew
> ---
> gdb/testsuite/gdb.fortran/print-formatted.exp | 3 ++-
> gdb/testsuite/gdb.fortran/print-formatted.f90 | 1 +
> 2 files changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/gdb/testsuite/gdb.fortran/print-formatted.exp b/gdb/testsuite/gdb.fortran/print-formatted.exp
> index eaeca1ede2..59b7148852 100644
> --- a/gdb/testsuite/gdb.fortran/print-formatted.exp
> +++ b/gdb/testsuite/gdb.fortran/print-formatted.exp
> @@ -29,7 +29,8 @@ if { ![fortran_runto_main] } {
> return -1
> }
>
> -gdb_test "next" ".*" "go to the end of the program"
> +gdb_breakpoint [gdb_get_line_number "End of program"]
> +gdb_continue_to_breakpoint "End of program" ".*End of program.*"
>
> gdb_test "set output-radix 16" \
> "Output radix now set to decimal 16, hex 10, octal 20." \
> diff --git a/gdb/testsuite/gdb.fortran/print-formatted.f90 b/gdb/testsuite/gdb.fortran/print-formatted.f90
> index 63048032b1..f37fdafe97 100644
> --- a/gdb/testsuite/gdb.fortran/print-formatted.f90
> +++ b/gdb/testsuite/gdb.fortran/print-formatted.f90
> @@ -17,4 +17,5 @@ program printformatted
> integer :: ii
>
> ii = 10
> + print *, ii ! End of program.
> end program printformatted
> --
> 2.25.1
>
> Intel Deutschland GmbH
> Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
> Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
> Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva
> Chairperson of the Supervisory Board: Nicole Lau
> Registered Office: Munich
> Commercial Register: Amtsgericht Muenchen HRB 186928
More information about the Gdb-patches
mailing list