[PATCH 3/4] testsuite, fortran: adapt tests for ifort's 'start' behavior

Nils-Christian Kempke nils-christian.kempke@intel.com
Fri Jun 10 15:44:59 GMT 2022


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.  The changes skip running to the first breakpoint when
compiling with ifort, which improves test performance for ifort.  A
similar skip already existed for flang in vla-type.exp.
---
 gdb/testsuite/gdb.fortran/array-slices-bad.exp | 5 ++++-
 gdb/testsuite/gdb.fortran/vla-type.exp         | 5 +++--
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/gdb/testsuite/gdb.fortran/array-slices-bad.exp b/gdb/testsuite/gdb.fortran/array-slices-bad.exp
index b832fea292..514f208577 100644
--- a/gdb/testsuite/gdb.fortran/array-slices-bad.exp
+++ b/gdb/testsuite/gdb.fortran/array-slices-bad.exp
@@ -40,7 +40,10 @@ gdb_breakpoint [gdb_get_line_number "First Breakpoint"]
 gdb_breakpoint [gdb_get_line_number "Second Breakpoint"]
 gdb_breakpoint [gdb_get_line_number "Final Breakpoint"]
 
-gdb_continue_to_breakpoint "First Breakpoint"
+# Ifort is already at this line after runto_main.
+if { ![test_compiler_info {ifort-*} f90] } {
+    gdb_continue_to_breakpoint "First Breakpoint"
+}
 
 # Access not yet allocated array.
 gdb_test "print other" " = <not allocated>"
diff --git a/gdb/testsuite/gdb.fortran/vla-type.exp b/gdb/testsuite/gdb.fortran/vla-type.exp
index fc8494fe36..884e0dc113 100755
--- a/gdb/testsuite/gdb.fortran/vla-type.exp
+++ b/gdb/testsuite/gdb.fortran/vla-type.exp
@@ -32,8 +32,9 @@ 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] } {
+# Run to main for for Flang and ifort compilers already breaks here.
+if { ![test_compiler_info {flang-*} f90]
+     && ![test_compiler_info {ifort-*} f90]} {
     gdb_breakpoint [gdb_get_line_number "before-allocated"]
     gdb_continue_to_breakpoint "before-allocated"
 }
-- 
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