From: Richard Bunt Date: Mon, 10 Jul 2023 07:43:59 +0000 (+0100) Subject: gdb/testsuite: Testing with the nvfortran compiler X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c432a27df338c6720303c29eab18467cfc981cb8;p=binutils-gdb.git gdb/testsuite: Testing with the nvfortran compiler Currently, the Fortran test suite does not run with NVIDIA's Fortran compiler (nvfortran). The goal here is to get the tests running and preventing further regressions during future work. This change does not do anything to fix existing failures. Teach the compiler detection about nvfortran. There is no underlying information about whether this compiler is related to flang classic or flang, so we cannot reuse the main and type definitions. Therefore, we explicitly record the main method and type information observed when using nvfortran. The main name was extracted by trying to set breakpoints on both MAIN_ and MAIN__. The following mapping of test to type names was used to extract how nvfortran reports types. info-types.exp: fortran_int4, fortran_int8, fortran_real4, fortran_logical4 common-block.exp: fortran_real8 complex.exp: fortran_complex4 fortran_complex8 logical.exp: fortran_character1. Ran ptype on "c". Types defined as fortran_complex16 do not compile with nvfortran, so it was left unset. gdb.fortran regression tests run with GNU, Intel, Intel LLVM and ACfL. No regressions detected. The gdb.fortran test results with nvfortran 23.3 are as follows. Before: # of expected passes 523 # of unexpected failures 107 # of known failures 2 # of unresolved testcases 1 # of untested testcases 7 # of duplicate test names 2 After: # of expected passes 5696 # of unexpected failures 271 # of known failures 12 # of untested testcases 9 # of unsupported tests 5 As can be seen from the above, there are now considerably more passing assertions. Approved-By: Tom Tromey --- diff --git a/gdb/testsuite/lib/compiler.F90 b/gdb/testsuite/lib/compiler.F90 index 14a6521a8a4..8804f7f175d 100644 --- a/gdb/testsuite/lib/compiler.F90 +++ b/gdb/testsuite/lib/compiler.F90 @@ -24,6 +24,10 @@ set compiler_info [join {gfortran __GNUC__ __GNUC_MINOR__ __GNUC_PATCHLEVEL__} - set compiler_info [join {armflang __armclang_major__ __armclang_minor__ 0} -] #endif +#if defined (__NVCOMPILER_MAJOR__) +set compiler_info [join {nvfortran __NVCOMPILER_MAJOR__ __NVCOMPILER_MINOR__ __NVCOMPILER_PATCHLEVEL__} -] +#endif + /* Classic flang and LLVM flang emit their respective macros differently. */ /* LLVM flang complains about non Fortran tokens so we do not use "{" here. */ diff --git a/gdb/testsuite/lib/fortran.exp b/gdb/testsuite/lib/fortran.exp index 357a2c12358..2fd678df0a1 100644 --- a/gdb/testsuite/lib/fortran.exp +++ b/gdb/testsuite/lib/fortran.exp @@ -34,7 +34,8 @@ proc fortran_int4 {} { return "int4" } elseif {[test_compiler_info {gfortran-*} f90]} { return "integer\\(kind=4\\)" - } elseif {[test_compiler_info {flang-*} f90]} { + } elseif {[test_compiler_info {flang-*} f90] + || [test_compiler_info {nvfortran-*} f90]} { return "integer" } elseif {[test_compiler_info {ifort-*} f90]} { return "INTEGER\\(4\\)" @@ -50,7 +51,8 @@ proc fortran_int8 {} { return "int8" } elseif {[test_compiler_info {gfortran-*} f90]} { return "integer\\(kind=8\\)" - } elseif {[test_compiler_info {flang-*} f90]} { + } elseif {[test_compiler_info {flang-*} f90] + || [test_compiler_info {nvfortran-*} f90]} { return "integer\\*8" } elseif {[test_compiler_info {ifort-*} f90]} { return "INTEGER\\(8\\)" @@ -66,7 +68,8 @@ proc fortran_real4 {} { return "real4" } elseif {[test_compiler_info {gfortran-*} f90]} { return "real\\(kind=4\\)" - } elseif {[test_compiler_info {flang-*} f90]} { + } elseif {[test_compiler_info {flang-*} f90] + || [test_compiler_info {nvfortran-*} f90]} { return "real" } elseif {[test_compiler_info {ifort-*} f90]} { return "REAL\\(4\\)" @@ -82,7 +85,8 @@ proc fortran_real8 {} { return "real8" } elseif {[test_compiler_info {gfortran-*} f90]} { return "real\\(kind=8\\)" - } elseif {[test_compiler_info {flang-*} f90]} { + } elseif {[test_compiler_info {flang-*} f90] + || [test_compiler_info {nvfortran-*} f90]} { return "double precision" } elseif {[test_compiler_info {ifort-*} f90]} { return "REAL\\(8\\)" @@ -98,7 +102,8 @@ proc fortran_complex4 {} { return "complex4" } elseif {[test_compiler_info {gfortran-*} f90]} { return "complex\\(kind=4\\)" - } elseif {[test_compiler_info {flang-*} f90]} { + } elseif {[test_compiler_info {flang-*} f90] + || [test_compiler_info {nvfortran-*} f90]} { return "complex" } elseif {[test_compiler_info {ifort-*} f90]} { return "COMPLEX\\(4\\)" @@ -114,7 +119,8 @@ proc fortran_complex8 {} { return "complex8" } elseif {[test_compiler_info {gfortran-*} f90]} { return "complex\\(kind=8\\)" - } elseif {[test_compiler_info {flang-*} f90]} { + } elseif {[test_compiler_info {flang-*} f90] + || [test_compiler_info {nvfortran-*} f90]} { return "double complex" } elseif {[test_compiler_info {ifort-*} f90]} { return "COMPLEX\\(8\\)" @@ -146,7 +152,8 @@ proc fortran_logical4 {} { return "logical4" } elseif {[test_compiler_info {gfortran-*} f90]} { return "logical\\(kind=4\\)" - } elseif {[test_compiler_info {flang-*} f90]} { + } elseif {[test_compiler_info {flang-*} f90] + || [test_compiler_info {nvfortran-*} f90]} { return "logical" } elseif {[test_compiler_info {ifort-*} f90]} { return "LOGICAL\\(4\\)" @@ -164,6 +171,8 @@ proc fortran_character1 {} { return "character\\(kind=1\\)" } elseif {[test_compiler_info {flang-*} f90]} { return "character" + } elseif {[test_compiler_info {nvfortran-*} f90]} { + return "character\\*1" } elseif {[test_compiler_info {ifort-*} f90]} { return "CHARACTER\\(1\\)" } elseif {[test_compiler_info {ifx-*} f90]} { @@ -181,7 +190,8 @@ proc fortran_main {} { || [test_compiler_info {ifx-*} f90] || [test_compiler_info {flang-llvm-*} f90]} { return "MAIN__" - } elseif {[test_compiler_info {flang-classic-*} f90]} { + } elseif {[test_compiler_info {flang-classic-*} f90] + || [test_compiler_info {nvfortran-*} f90]} { return "MAIN_" } else { return "unknown"