gdb.fortran: Allow Flang kind printing in fortran testing
authorAlok Kumar Sharma <AlokKumar.Sharma@amd.com>
Wed, 4 Mar 2020 11:46:52 +0000 (17:16 +0530)
committerAlok Kumar Sharma <AlokKumar.Sharma@amd.com>
Wed, 4 Mar 2020 11:46:52 +0000 (17:16 +0530)
In lib/fortran.exp, in the helper function fortran_int4, kind
parameter is expected to be printed as (kind=4) for the LLVM
Fortran compiler, Flang along with gfortran.  And in the helper
function fortran_int8 kind parameter is expected to be printed
as (kind=8).  But for the Flang compiler default kind is not
printed and non default kind is printed differently than gfortran
as below.
  integer(kind=4) => integer
  integer(kind=8) => integer*8
  real(kind=4) => real
  real(kind=8) => double precision
  complex(kind=4) => complex
  logical(kind=4) => logical
  character(kind=1) => character
This commit adds support for printing of kind parameter for the
Flang.  There should be no change when testing with gfortran.

Note: The current patch overrides earlier patch with below details.
  commit c3b149eb7697b376df1b3a47d0102afda389ee6d
  Author Alok Kumar Sharma (alokkumar.sharma@amd.com)
Earlier patch was incomplete and based on assumption that flang
should be changed to dump a type with kind like the way gfortan does.
Later it was realized that the way flang dumps this info is not
incorrect but different. And changes in gdb test framework are
finalized.

gdb/testsuite/ChangeLog:

* lib/fortran.exp (fortran_int4): Handle flang kind printing.
(fortran_int8): Likewise.
(fortran_real4): Likewise.
(fortran_real8): Likewise.
(fortran_complex4): Likewise.
(fortran_logical4): Likewise.
(fortran_character1): Likewise.

gdb/testsuite/ChangeLog
gdb/testsuite/lib/fortran.exp

index 3912a1c6091945483c06f05a08c596a829c7201d..acd155f924450b69169abd38f5f8a8e2bf778ab4 100644 (file)
@@ -1,3 +1,13 @@
+2020-03-04  Alok Kumar Sharma  <AlokKumar.Sharma@amd.com>
+
+       * lib/fortran.exp (fortran_int4): Handle flang kind printing.
+       (fortran_int8): Likewise.
+       (fortran_real4): Likewise.
+       (fortran_real8): Likewise.
+       (fortran_complex4): Likewise.
+       (fortran_logical4): Likewise.
+       (fortran_character1): Likewise.
+
 2020-03-03  Andrew Burgess  <andrew.burgess@embecosm.com>
 
        * gdb.fortran/logical.exp: Add tests that any non-zero value is
index 54f32936773930b47e334607b91ac5a3643ba098..549ed657904fad2f6b1c11051f608b3e643b243b 100644 (file)
@@ -32,9 +32,10 @@ proc set_lang_fortran {} {
 proc fortran_int4 {} {
     if {[test_compiler_info {gcc-4-[012]-*}]} {
        return "int4"
-    } elseif {[test_compiler_info {gcc-*}]
-             || [test_compiler_info {clang-*}]} {
+    } elseif {[test_compiler_info {gcc-*}]} {
        return "integer\\(kind=4\\)"
+    } elseif {[test_compiler_info {clang-*}]} {
+       return "integer"
     } elseif {[test_compiler_info {icc-*}]} {
        return "INTEGER\\(4\\)"
     } else {
@@ -45,9 +46,10 @@ proc fortran_int4 {} {
 proc fortran_int8 {} {
     if {[test_compiler_info {gcc-4-[012]-*}]} {
        return "int8"
-    } elseif {[test_compiler_info {gcc-*}]
-             || [test_compiler_info {clang-*}]} {
+    } elseif {[test_compiler_info {gcc-*}]} {
        return "integer\\(kind=8\\)"
+    } elseif {[test_compiler_info {clang-*}]} {
+       return "integer*8"
     } elseif {[test_compiler_info {icc-*}]} {
        return "INTEGER\\(8\\)"
     } else {
@@ -58,9 +60,10 @@ proc fortran_int8 {} {
 proc fortran_real4 {} {
     if {[test_compiler_info {gcc-4-[012]-*}]} {
        return "real4"
-    } elseif {[test_compiler_info {gcc-*}]
-             || [test_compiler_info {clang-*}]} {
+    } elseif {[test_compiler_info {gcc-*}]} {
        return "real\\(kind=4\\)"
+    } elseif {[test_compiler_info {clang-*}]} {
+       return "real"
     } elseif {[test_compiler_info {icc-*}]} {
        return "REAL\\(4\\)"
     } else {
@@ -71,9 +74,10 @@ proc fortran_real4 {} {
 proc fortran_real8 {} {
     if {[test_compiler_info {gcc-4-[012]-*}]} {
        return "real8"
-    } elseif {[test_compiler_info {gcc-*}]
-             || [test_compiler_info {clang-*}]} {
+    } elseif {[test_compiler_info {gcc-*}]} {
        return "real\\(kind=8\\)"
+    } elseif {[test_compiler_info {clang-*}]} {
+       return "double precision"
     } elseif {[test_compiler_info {icc-*}]} {
        return "REAL\\(8\\)"
     } else {
@@ -84,9 +88,10 @@ proc fortran_real8 {} {
 proc fortran_complex4 {} {
     if {[test_compiler_info {gcc-4-[012]-*}]} {
        return "complex4"
-    } elseif {[test_compiler_info {gcc-*}]
-             || [test_compiler_info {clang-*}]} {
+    } elseif {[test_compiler_info {gcc-*}]} {
        return "complex\\(kind=4\\)"
+    } elseif {[test_compiler_info {clang-*}]} {
+       return "complex"
     } elseif {[test_compiler_info {icc-*}]} {
        return "COMPLEX\\(4\\)"
     } else {
@@ -97,9 +102,10 @@ proc fortran_complex4 {} {
 proc fortran_logical4 {} {
     if {[test_compiler_info {gcc-4-[012]-*}]} {
        return "logical4"
-    } elseif {[test_compiler_info {gcc-*}]
-             || [test_compiler_info {clang-*}]} {
+    } elseif {[test_compiler_info {gcc-*}]} {
        return "logical\\(kind=4\\)"
+    } elseif {[test_compiler_info {clang-*}]} {
+       return "logical"
     } elseif {[test_compiler_info {icc-*}]} {
        return "LOGICAL\\(4\\)"
     } else {
@@ -110,9 +116,10 @@ proc fortran_logical4 {} {
 proc fortran_character1 {} {
     if {[test_compiler_info {gcc-4-[012]-*}]} {
        return "character1"
-    } elseif {[test_compiler_info {gcc-*}]
-             || [test_compiler_info {clang-*}]} {
+    } elseif {[test_compiler_info {gcc-*}]} {
        return "character\\(kind=1\\)"
+    } elseif {[test_compiler_info {clang-*}]} {
+       return "character"
     } elseif {[test_compiler_info {icc-*}]} {
        return "CHARACTER\\(1\\)"
     } else {