File gdb-testsuite-skip-gdb.fortran-namelist.exp-for-gfortran-4.8.patch of Package gdb.28855

[gdb/testsuite] Skip gdb.fortran/namelist.exp for gfortran 4.8

The test-case gdb.fortran/namelist.exp uses a gfortran feature (emitting
DW_TAG_namelist in the debug info) that has been supported since gfortran 4.9,
see PR gcc/37132.

Skip the test for gfortran 4.8 and earlier.  Do this using gcc_major_version,
and update it to be able to handle "gcc_major_version {gfortran-*} f90".

Tested on x86_64-linux, with gfortran 4.8.5, 7.5.0, and 12.1.1.

---
 gdb/testsuite/gdb.fortran/namelist.exp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/gdb/testsuite/gdb.fortran/namelist.exp b/gdb/testsuite/gdb.fortran/namelist.exp
index d6263e12fec..464f2f84fc2 100644
--- a/gdb/testsuite/gdb.fortran/namelist.exp
+++ b/gdb/testsuite/gdb.fortran/namelist.exp
@@ -37,7 +37,11 @@ set int [fortran_int4]
 gdb_breakpoint [gdb_get_line_number "Display namelist"]
 gdb_continue_to_breakpoint "Display namelist"
 
-if {[test_compiler_info {gcc-*}]} {
+# DW_TAG_namelist is supported starting gcc 4.9.
+set supported [expr \
+		   [test_compiler_info {gcc-*}] \
+		   && [gcc_major_version] >= 4.9]
+if { $supported } {
     gdb_test "ptype nml" \
         "type = Type nml\r\n *$int :: a\r\n *$int :: b\r\n *End Type nml"
     gdb_test "print nml" \
openSUSE Build Service is sponsored by