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"
