public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH v1] gdb/testsuite: Testing with the nvfortran compiler
@ 2023-06-21  9:39 Richard Bunt
  2023-06-22 16:13 ` Tom Tromey
  0 siblings, 1 reply; 2+ messages in thread
From: Richard Bunt @ 2023-06-21  9:39 UTC (permalink / raw)
  To: gdb-patches, agontarek; +Cc: Richard Bunt

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.

---
 gdb/testsuite/lib/compiler.F90 |  4 ++++
 gdb/testsuite/lib/fortran.exp  | 26 ++++++++++++++++++--------
 2 files changed, 22 insertions(+), 8 deletions(-)

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..fb24ee315be 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"
-- 
2.32.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v1] gdb/testsuite: Testing with the nvfortran compiler
  2023-06-21  9:39 [PATCH v1] gdb/testsuite: Testing with the nvfortran compiler Richard Bunt
@ 2023-06-22 16:13 ` Tom Tromey
  0 siblings, 0 replies; 2+ messages in thread
From: Tom Tromey @ 2023-06-22 16:13 UTC (permalink / raw)
  To: Richard Bunt via Gdb-patches; +Cc: agontarek, Richard Bunt

>>>>> "Richard" == Richard Bunt via Gdb-patches <gdb-patches@sourceware.org> writes:

Richard> Currently, the Fortran test suite does not run with NVIDIA's Fortran
Richard> compiler (nvfortran).

Thank you for the patch.

Richard> +    } elseif {[test_compiler_info {nvfortran-*} f90]} {
Richard> +	return "character*1"

I suspect this proc is returning a regular expression and so you
probably want

    return "character\\*1"

There's an example of this later in the proc.

Tom

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-06-22 16:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-21  9:39 [PATCH v1] gdb/testsuite: Testing with the nvfortran compiler Richard Bunt
2023-06-22 16:13 ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).