testsuite, fortran: adapt tests for ifort's 'start' behavior

The modified tests array-slices-bad.exp and vla-type.exp both set a
breakpoint at the first real statement in the respective executables.

Normally, the expected behavior of fortran_runto_main for these would be
the stopping of the debugger at exactly the first statment in the code.

Strangely, neither gfortran nor ifx seem to do this for these tests.
Instead, issuing 'start' in ifx (for either of the 2 tests) lets GDB
stop at the 'program ...' line and gfortran stops at a variable
declaration line.  E.g. for vla-type it stops at

  41        type(five)               :: fivearr (2)

So, actually, ifort's behavior can be considered to be a bit more
'correct' here.  This patch remove the fortran_runto_main in the
two tests and instead uses runto to directly run to the first breakpoint
set at the first program statement.  This works with both compiler
behaviors and makes the tests more robust.

Approved-by: Kevin Buettner <kevinb@redhat.com>
This commit is contained in:
Nils-Christian Kempke
2022-05-20 10:25:57 +02:00
committed by Ijaz, Abdul B
parent 6fe8aea3c0
commit 41439185cd
2 changed files with 8 additions and 16 deletions

View File

@@ -28,20 +28,17 @@ if {[prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
# Avoid shared lib symbols.
gdb_test_no_output "set auto-solib-add off"
if ![fortran_runto_main] {
return -1
}
# Avoid libc symbols, in particular the 'array' type.
gdb_test_no_output "nosharedlibrary"
# gdb_breakpoint [gdb_get_line_number "Display Message Breakpoint"]
gdb_breakpoint [gdb_get_line_number "First Breakpoint"]
if {![runto [gdb_get_line_number "First Breakpoint"]]} {
perror "couldn't run to breakpoint First Breakpoint"
return -1
}
gdb_breakpoint [gdb_get_line_number "Second Breakpoint"]
gdb_breakpoint [gdb_get_line_number "Final Breakpoint"]
gdb_continue_to_breakpoint "First Breakpoint"
# Access not yet allocated array.
gdb_test "print other" " = <not allocated>"
gdb_test "print other(0:4,2:3)" "array not allocated"

View File

@@ -23,19 +23,14 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
return -1
}
if ![fortran_runto_main] {
return -1
}
# Depending on the compiler being used, the type names can be printed differently.
set int [fortran_int4]
# Check if not allocated VLA in type does not break
# the debugger when accessing it.
# break main for Flang compiler already breaks here
if { ![test_compiler_info {flang-*} f90] } {
gdb_breakpoint [gdb_get_line_number "before-allocated"]
gdb_continue_to_breakpoint "before-allocated"
if {![runto [gdb_get_line_number "before-allocated"]]} {
perror "couldn't run to breakpoint before-allocated"
return -1
}
gdb_test "print twov" " = \\\( ivla1 = <not allocated>, ivla2 = <not allocated> \\\)" \