public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH V2 0/2] fortran: Testsuite, fix different type naming across compilers.
@ 2016-04-15 12:46 Bernhard Heckel
  2016-04-15 12:47 ` [PATCH V2 1/2] testsuite: Support detection of Intel compilers via test_compiler_version Bernhard Heckel
  2016-04-15 12:47 ` [PATCH V2 2/2] fortran: Testsuite, fix different type naming across compilers Bernhard Heckel
  0 siblings, 2 replies; 8+ messages in thread
From: Bernhard Heckel @ 2016-04-15 12:46 UTC (permalink / raw)
  To: qiyaoltc; +Cc: gdb-patches, brobecker, Bernhard Heckel

This patch series supports detection of Intel compilers and fixes
failing fortran testcases due to different type naming.

Bernhard Heckel (2):
  testsuite: Support detection of Intel compilers via
    test_compiler_version.
  fortran: Testsuite, fix different type naming across compilers.

 gdb/testsuite/gdb.fortran/common-block.exp  |  5 +-
 gdb/testsuite/gdb.fortran/derived-type.exp  | 13 ++---
 gdb/testsuite/gdb.fortran/multi-dim.exp     |  8 +--
 gdb/testsuite/gdb.fortran/vla-datatypes.exp |  9 +--
 gdb/testsuite/gdb.fortran/vla-ptype-sub.exp | 33 +++++------
 gdb/testsuite/gdb.fortran/vla-ptype.exp     | 21 +++----
 gdb/testsuite/gdb.fortran/whatis_type.exp   |  5 +-
 gdb/testsuite/lib/compiler.c                | 12 ++++
 gdb/testsuite/lib/compiler.cc               | 12 ++++
 gdb/testsuite/lib/fortran.exp               | 88 +++++++++++++++++++++++++++++
 gdb/testsuite/lib/gdb.exp                   |  3 +
 11 files changed, 158 insertions(+), 51 deletions(-)
 mode change 100644 => 100755 gdb/testsuite/lib/compiler.c
 mode change 100644 => 100755 gdb/testsuite/lib/compiler.cc

-- 
2.7.1.339.g0233b80

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

* [PATCH V2 1/2] testsuite: Support detection of Intel compilers via test_compiler_version.
  2016-04-15 12:46 [PATCH V2 0/2] fortran: Testsuite, fix different type naming across compilers Bernhard Heckel
@ 2016-04-15 12:47 ` Bernhard Heckel
  2016-04-15 15:00   ` Yao Qi
  2016-04-15 12:47 ` [PATCH V2 2/2] fortran: Testsuite, fix different type naming across compilers Bernhard Heckel
  1 sibling, 1 reply; 8+ messages in thread
From: Bernhard Heckel @ 2016-04-15 12:47 UTC (permalink / raw)
  To: qiyaoltc; +Cc: gdb-patches, brobecker, Bernhard Heckel

Add Intel specific preprocessor macros to query the version of the compiler.

2016-04-15  Bernhard Heckel  <bernhard.heckel@intel.com>

gdb/Testsuite/Changelog:
	* lib/compiler.c: Add Intel specific preprocessor macros.
	* lib/compiler.cc: Likewise.
	* lib/gdb.exp (gdb_compile_shlib): Add flags for ICC compiler.

---
 gdb/testsuite/lib/compiler.c  | 12 ++++++++++++
 gdb/testsuite/lib/compiler.cc | 12 ++++++++++++
 gdb/testsuite/lib/gdb.exp     |  3 +++
 3 files changed, 27 insertions(+)
 mode change 100644 => 100755 gdb/testsuite/lib/compiler.c
 mode change 100644 => 100755 gdb/testsuite/lib/compiler.cc

diff --git a/gdb/testsuite/lib/compiler.c b/gdb/testsuite/lib/compiler.c
old mode 100644
new mode 100755
index f2e3062..408435d
--- a/gdb/testsuite/lib/compiler.c
+++ b/gdb/testsuite/lib/compiler.c
@@ -56,3 +56,15 @@ set compiler_info [join {armcc __ARMCC_VERSION} -]
 #if defined (__clang__)
 set compiler_info [join {clang __clang_major__ __clang_minor__ __clang_patchlevel__} -]
 #endif
+
+#if defined (__ICC)
+set icc_major [string range __ICC 0 1]
+set icc_minor [format "%d" [string range __ICC 2 [expr {[string length __ICC] -1}]]]
+set icc_update __INTEL_COMPILER_UPDATE
+set compiler_info [join "icc $icc_major $icc_minor $icc_update" -]
+#elif defined (__ICL)
+set icc_major [string range __ICL 0 1]
+set icc_minor [format "%d" [string range __ICL 2 [expr {[string length __ICL] -1}]]]
+set icc_update __INTEL_COMPILER_UPDATE
+set compiler_info [join "icc $icc_major $icc_minor $icc_update" -]
+#endif
diff --git a/gdb/testsuite/lib/compiler.cc b/gdb/testsuite/lib/compiler.cc
old mode 100644
new mode 100755
index 39761ff..dbe2c6f
--- a/gdb/testsuite/lib/compiler.cc
+++ b/gdb/testsuite/lib/compiler.cc
@@ -44,3 +44,15 @@ set compiler_info [join {armcc __ARMCC_VERSION} -]
 #if defined (__clang__)
 set compiler_info [join {clang __clang_major__ __clang_minor__ __clang_patchlevel__} -]
 #endif
+
+#if defined (__ICC)
+set icc_major [string range __ICC 0 1]
+set icc_minor [format "%d" [string range __ICC 2 [expr {[string length __ICC] -1}]]]
+set icc_update __INTEL_COMPILER_UPDATE
+set compiler_info [join "icc $icc_major $icc_minor $icc_update" -]
+#elif defined (__ICL)
+set icc_major [string range __ICL 0 1]
+set icc_minor [format "%d" [string range __ICL 2 [expr {[string length __ICL] -1}]]]
+set icc_update __INTEL_COMPILER_UPDATE
+set compiler_info [join "icc $icc_major $icc_minor $icc_update" -]
+#endif
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 1ef6a96..75c5e68 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -3553,6 +3553,9 @@ proc gdb_compile_shlib {sources dest options} {
                 lappend obj_options "additional_flags=-fpic"
             }
         }
+        "icc-*" {
+                lappend obj_options "additional_flags=-fpic"
+        }
         default {
 	    # don't know what the compiler is...
         }
-- 
2.7.1.339.g0233b80

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

* [PATCH V2 2/2] fortran: Testsuite, fix different type naming across compilers.
  2016-04-15 12:46 [PATCH V2 0/2] fortran: Testsuite, fix different type naming across compilers Bernhard Heckel
  2016-04-15 12:47 ` [PATCH V2 1/2] testsuite: Support detection of Intel compilers via test_compiler_version Bernhard Heckel
@ 2016-04-15 12:47 ` Bernhard Heckel
  2016-04-15 14:41   ` Yao Qi
  1 sibling, 1 reply; 8+ messages in thread
From: Bernhard Heckel @ 2016-04-15 12:47 UTC (permalink / raw)
  To: qiyaoltc; +Cc: gdb-patches, brobecker, Bernhard Heckel

Gfortran and ifort have different names for data types.  Encapsulate
type names in a library to increase number of supported compilers.
gfortran -4.2 : int4
gfortran>=4.3 : integer(kind=4)
ifort         : INTEGER(4)

2016-03-22  Bernhard Heckel  <bernhard.heckel@intel.com>

gdb/testsuite/Changelog:
	* gdb.fortran/common-block.exp: Use type naming defined in lib fortran.
	* gdb.fortran/derived-type.exp: Use type naming defined in lib fortran.
	* gdb.fortran/multi-dim.exp: Use type naming defined in lib fortran.
	* gdb.fortran/vla-datatypes.exp: Use type naming defined in lib fortran.
	* gdb.fortran/vla-ptype-sub.exp: Use type naming defined in lib fortran.
	* gdb.fortran/vla-ptype.exp: Use type naming defined in lib fortran.
	* gdb.fortran/whatis_type.exp: Use type naming defined in lib fortran.
	* lib/fortran.exp: Add type definition for gfortran and ifort compiler.

---
 gdb/testsuite/gdb.fortran/common-block.exp  |  5 +-
 gdb/testsuite/gdb.fortran/derived-type.exp  | 13 ++---
 gdb/testsuite/gdb.fortran/multi-dim.exp     |  8 +--
 gdb/testsuite/gdb.fortran/vla-datatypes.exp |  9 +--
 gdb/testsuite/gdb.fortran/vla-ptype-sub.exp | 33 +++++------
 gdb/testsuite/gdb.fortran/vla-ptype.exp     | 21 +++----
 gdb/testsuite/gdb.fortran/whatis_type.exp   |  5 +-
 gdb/testsuite/lib/fortran.exp               | 88 +++++++++++++++++++++++++++++
 8 files changed, 131 insertions(+), 51 deletions(-)

diff --git a/gdb/testsuite/gdb.fortran/common-block.exp b/gdb/testsuite/gdb.fortran/common-block.exp
index abdc50a..57960c2 100644
--- a/gdb/testsuite/gdb.fortran/common-block.exp
+++ b/gdb/testsuite/gdb.fortran/common-block.exp
@@ -21,6 +21,7 @@ if {[skip_fortran_tests]} {
 }
 
 standard_testfile .f90
+load_lib "fortran.exp"
 
 if {[prepare_for_testing ${testfile}.exp ${testfile} \
 	 $srcfile {debug f90 quiet}]} {
@@ -42,10 +43,6 @@ gdb_continue_to_breakpoint "stop-here-out"
 #set suffix "_"
 set suffix ""
 
-set int4 {(integer\(kind=4\)|INTEGER\(4\))}
-set real4 {(real\(kind=4\)|REAL\(4\))}
-set real8 {(real\(kind=8\)|REAL\(8\))}
-
 gdb_test "whatis foo$suffix" "No symbol \"foo$suffix\" in current context."
 gdb_test "ptype foo$suffix" "No symbol \"foo$suffix\" in current context."
 gdb_test "p foo$suffix" "No symbol \"foo$suffix\" in current context."
diff --git a/gdb/testsuite/gdb.fortran/derived-type.exp b/gdb/testsuite/gdb.fortran/derived-type.exp
index f7f10b5..48a69cc 100644
--- a/gdb/testsuite/gdb.fortran/derived-type.exp
+++ b/gdb/testsuite/gdb.fortran/derived-type.exp
@@ -21,6 +21,7 @@
 if { [skip_fortran_tests] } { return -1 }
 
 standard_testfile .f90
+load_lib "fortran.exp"
 
 if {[prepare_for_testing $testfile.exp $testfile $srcfile {debug f90}]} {
     return -1
@@ -31,20 +32,14 @@ if ![runto MAIN__] then {
     continue
 }
 
-# Depending on the compiler version being used, the name of the 4-byte integer
-# and real types can be printed differently.  For instance, gfortran-4.1 uses
-# "int4" whereas gfortran-4.3 uses "int(kind=4)".
-set int4 "(int4|integer\\(kind=4\\))"
-set real4 "(real4|real\\(kind=4\\))"
-
-gdb_test "ptype p" "type = Type bar\r\n *${int4} :: c\r\n *${real4} :: d\r\n *End Type bar"
+gdb_test "ptype p" "type = Type bar\r\n *$int :: c\r\n *$real :: d\r\n *End Type bar"
 
 set test "type-printing for derived type"
 gdb_test_multiple "ptype q" $test {
-    -re "type = Type foo\r\n *${real4} :: a\r\n *Type bar\r\n *${int4} :: c\r\n *${real4} :: d\r\n *End Type bar :: x\r\n *character\\*7 :: b\r\n *End Type foo\r\n$gdb_prompt $" {
+    -re "type = Type foo\r\n *$real :: a\r\n *Type bar\r\n *$int :: c\r\n *$real :: d\r\n *End Type bar :: x\r\n *character\\*7 :: b\r\n *End Type foo\r\n$gdb_prompt $" {
 	pass $test
     }
-    -re "type = Type foo\r\n *${real4} :: a\r\n *Type bar\r\n *${int4} :: c\r\n *${real4} :: d\r\n *End Type bar :: x\r\n *character :: b\\(7\\)\r\n *End Type foo\r\n$gdb_prompt $" {
+    -re "type = Type foo\r\n *$real :: a\r\n *Type bar\r\n *$int :: c\r\n *$real :: d\r\n *End Type bar :: x\r\n *character :: b\\(7\\)\r\n *End Type foo\r\n$gdb_prompt $" {
 	# Compiler should produce string, not an array of characters.
 	setup_xfail "*-*-*"
 	fail $test
diff --git a/gdb/testsuite/gdb.fortran/multi-dim.exp b/gdb/testsuite/gdb.fortran/multi-dim.exp
index abe37b8..1d6e22e 100644
--- a/gdb/testsuite/gdb.fortran/multi-dim.exp
+++ b/gdb/testsuite/gdb.fortran/multi-dim.exp
@@ -19,6 +19,7 @@
 if { [skip_fortran_tests] } { return -1 }
 
 standard_testfile .f90
+load_lib "fortran.exp"
 
 if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} {debug f90}] } {
     return -1
@@ -29,11 +30,6 @@ if ![runto MAIN__] {
     continue
 }
 
-# Depending on the compiler version being used, the name of the 4-byte integer
-# and real types can be printed differently.  For instance, gfortran-4.1 uses
-# "int4" whereas gfortran-4.3 uses "int(kind=4)".
-set int4 "(int4|integer\\(kind=4\\))"
-
 gdb_breakpoint [gdb_get_line_number "break-static"]
 gdb_continue_to_breakpoint "break-static" ".*break-static.*"
 
@@ -69,7 +65,7 @@ gdb_test "print varbound(4)" \
     "print valid variable bound array element"
 
 gdb_test "ptype unbound" \
-    "type = $int4 \\(\\*\\)" \
+    "type = $int \\(\\*\\)" \
     "print type of unbound array"
 
 gdb_test "print unbound(4)" \
diff --git a/gdb/testsuite/gdb.fortran/vla-datatypes.exp b/gdb/testsuite/gdb.fortran/vla-datatypes.exp
index ed74fa9..dbeec6b 100644
--- a/gdb/testsuite/gdb.fortran/vla-datatypes.exp
+++ b/gdb/testsuite/gdb.fortran/vla-datatypes.exp
@@ -14,6 +14,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 standard_testfile ".f90"
+load_lib "fortran.exp"
 
 if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
     {debug f90 quiet}] } {
@@ -48,13 +49,13 @@ gdb_test "print l" " = \\.TRUE\\." "charactervla allocated"
 
 gdb_breakpoint [gdb_get_line_number "vlas-initialized"]
 gdb_continue_to_breakpoint "vlas-initialized"
-gdb_test "ptype intvla" "type = integer\\\(kind=4\\\) \\\(11,22,33\\\)" \
+gdb_test "ptype intvla" "type = $int \\\(11,22,33\\\)" \
   "ptype intvla"
-gdb_test "ptype realvla" "type = real\\\(kind=4\\\) \\\(11,22,33\\\)" \
+gdb_test "ptype realvla" "type = $real \\\(11,22,33\\\)" \
   "ptype realvla"
-gdb_test "ptype complexvla" "type = complex\\\(kind=4\\\) \\\(11,22,33\\\)" \
+gdb_test "ptype complexvla" "type = $complex \\\(11,22,33\\\)" \
   "ptype complexvla"
-gdb_test "ptype logicalvla" "type = logical\\\(kind=4\\\) \\\(11,22,33\\\)" \
+gdb_test "ptype logicalvla" "type = $logical \\\(11,22,33\\\)" \
   "ptype logicalvla"
 gdb_test "ptype charactervla" "type = character\\\*1 \\\(11,22,33\\\)" \
   "ptype charactervla"
diff --git a/gdb/testsuite/gdb.fortran/vla-ptype-sub.exp b/gdb/testsuite/gdb.fortran/vla-ptype-sub.exp
index 7c98eed..761c70c 100644
--- a/gdb/testsuite/gdb.fortran/vla-ptype-sub.exp
+++ b/gdb/testsuite/gdb.fortran/vla-ptype-sub.exp
@@ -14,6 +14,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 standard_testfile "vla-sub.f90"
+load_lib "fortran.exp"
 
 if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
     {debug f90 quiet}] } {
@@ -28,24 +29,24 @@ if ![runto_main] {
 # Pass fixed array to function and handle them as vla in function.
 gdb_breakpoint [gdb_get_line_number "not-filled"]
 gdb_continue_to_breakpoint "not-filled (1st)"
-gdb_test "ptype array1" "type = integer\\\(kind=4\\\) \\\(42,42\\\)" \
+gdb_test "ptype array1" "type = $int \\\(42,42\\\)" \
   "ptype array1 (passed fixed)"
-gdb_test "ptype array2" "type = real\\\(kind=4\\\) \\\(42,42,42\\\)" \
+gdb_test "ptype array2" "type = $real \\\(42,42,42\\\)" \
   "ptype array2 (passed fixed)"
-gdb_test "ptype array1(40, 10)" "type = integer\\\(kind=4\\\)" \
+gdb_test "ptype array1(40, 10)" "type = $int" \
   "ptype array1(40, 10) (passed fixed)"
-gdb_test "ptype array2(13, 11, 5)" "type = real\\\(kind=4\\\)" \
+gdb_test "ptype array2(13, 11, 5)" "type = $real" \
   "ptype array2(13, 11, 5) (passed fixed)"
 
 # Pass sub arrays to function and handle them as vla in function.
 gdb_continue_to_breakpoint "not-filled (2nd)"
-gdb_test "ptype array1" "type = integer\\\(kind=4\\\) \\\(6,6\\\)" \
+gdb_test "ptype array1" "type = $int \\\(6,6\\\)" \
   "ptype array1 (passed sub-array)"
-gdb_test "ptype array2" "type = real\\\(kind=4\\\) \\\(6,6,6\\\)" \
+gdb_test "ptype array2" "type = $real \\\(6,6,6\\\)" \
   "ptype array2 (passed sub-array)"
-gdb_test "ptype array1(3, 3)" "type = integer\\\(kind=4\\\)" \
+gdb_test "ptype array1(3, 3)" "type = $int" \
   "ptype array1(3, 3) (passed sub-array)"
-gdb_test "ptype array2(4, 4, 4)" "type = real\\\(kind=4\\\)" \
+gdb_test "ptype array2(4, 4, 4)" "type = $real" \
   "ptype array2(4, 4, 4) (passed sub-array)"
 
 # Check ptype outside of bounds.  This should not crash GDB.
@@ -56,13 +57,13 @@ gdb_test "ptype array2(100, 100, 100)" "no such vector element" \
 
 # Pass vla to function.
 gdb_continue_to_breakpoint "not-filled (3rd)"
-gdb_test "ptype array1" "type = integer\\\(kind=4\\\) \\\(20,20\\\)" \
+gdb_test "ptype array1" "type = $int \\\(20,20\\\)" \
   "ptype array1 (passed vla)"
-gdb_test "ptype array2" "type = real\\\(kind=4\\\) \\\(10,10,10\\\)" \
+gdb_test "ptype array2" "type = $real \\\(10,10,10\\\)" \
   "ptype array2 (passed vla)"
-gdb_test "ptype array1(3, 3)" "type = integer\\\(kind=4\\\)" \
+gdb_test "ptype array1(3, 3)" "type = $int" \
   "ptype array1(3, 3) (passed vla)"
-gdb_test "ptype array2(4, 4, 4)" "type = real\\\(kind=4\\\)" \
+gdb_test "ptype array2(4, 4, 4)" "type = $real" \
   "ptype array2(4, 4, 4) (passed vla)"
 
 # Check ptype outside of bounds.  This should not crash GDB.
@@ -76,12 +77,12 @@ gdb_test "ptype array2(100, 100, 100)" "no such vector element" \
 gdb_breakpoint [gdb_get_line_number "end-of-bar"]
 gdb_continue_to_breakpoint "end-of-bar"
 gdb_test "ptype array1" \
-  "type = (PTR TO -> \\( )?integer(\\(kind=4\\)|\\*4) \\(\\*\\)\\)?" \
+  "type = (PTR TO -> \\( )?$int \\(\\*\\)\\)?" \
   "ptype array1 (arbitrary length)"
 gdb_test "ptype array2" \
-  "type = (PTR TO -> \\( )?integer(\\(kind=4\\)|\\*4) \\(4:9,10:\\*\\)\\)?" \
+  "type = (PTR TO -> \\( )?$int \\(4:9,10:\\*\\)\\)?" \
   "ptype array2 (arbitrary length)"
-gdb_test "ptype array1(100)" "type = integer\\\(kind=4\\\)" \
+gdb_test "ptype array1(100)" "type = $int" \
   "ptype array1(100) (arbitrary length)"
-gdb_test "ptype array2(4,100)" "type = integer\\\(kind=4\\\)" \
+gdb_test "ptype array2(4,100)" "type = $int" \
   "ptype array2(4,100) (arbitrary length)"
diff --git a/gdb/testsuite/gdb.fortran/vla-ptype.exp b/gdb/testsuite/gdb.fortran/vla-ptype.exp
index 51da229..cee0a4c 100644
--- a/gdb/testsuite/gdb.fortran/vla-ptype.exp
+++ b/gdb/testsuite/gdb.fortran/vla-ptype.exp
@@ -14,6 +14,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 standard_testfile "vla.f90"
+load_lib "fortran.exp"
 
 if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
     {debug f90 quiet}] } {
@@ -39,40 +40,40 @@ gdb_test "ptype vla2(5, 45, 20)" \
 
 gdb_breakpoint [gdb_get_line_number "vla1-allocated"]
 gdb_continue_to_breakpoint "vla1-allocated"
-gdb_test "ptype vla1" "type = real\\\(kind=4\\\) \\\(10,10,10\\\)" \
+gdb_test "ptype vla1" "type = $real \\\(10,10,10\\\)" \
   "ptype vla1 allocated"
 
 gdb_breakpoint [gdb_get_line_number "vla2-allocated"]
 gdb_continue_to_breakpoint "vla2-allocated"
-gdb_test "ptype vla2" "type = real\\\(kind=4\\\) \\\(7,42:50,13:35\\\)" \
+gdb_test "ptype vla2" "type = $real \\\(7,42:50,13:35\\\)" \
   "ptype vla2 allocated"
 
 gdb_breakpoint [gdb_get_line_number "vla1-filled"]
 gdb_continue_to_breakpoint "vla1-filled"
-gdb_test "ptype vla1" "type = real\\\(kind=4\\\) \\\(10,10,10\\\)" \
+gdb_test "ptype vla1" "type = $real \\\(10,10,10\\\)" \
   "ptype vla1 filled"
-gdb_test "ptype vla1(3, 6, 9)" "type = real\\\(kind=4\\\)" \
+gdb_test "ptype vla1(3, 6, 9)" "type = $real" \
   "ptype vla1(3, 6, 9)"
 
 gdb_breakpoint [gdb_get_line_number "vla2-filled"]
 gdb_continue_to_breakpoint "vla2-filled"
-gdb_test "ptype vla2" "type = real\\\(kind=4\\\) \\\(7,42:50,13:35\\\)" \
+gdb_test "ptype vla2" "type = $real \\\(7,42:50,13:35\\\)" \
   "ptype vla2 filled"
-gdb_test "ptype vla2(5, 45, 20)" "type = real\\\(kind=4\\\)" \
+gdb_test "ptype vla2(5, 45, 20)" "type = $real" \
   "ptype vla1(5, 45, 20) filled"
 
 gdb_breakpoint [gdb_get_line_number "pvla-associated"]
 gdb_continue_to_breakpoint "pvla-associated"
-gdb_test "ptype pvla" "type = real\\\(kind=4\\\) \\\(10,10,10\\\)" \
+gdb_test "ptype pvla" "type = $real \\\(10,10,10\\\)" \
   "ptype pvla associated"
-gdb_test "ptype pvla(3, 6, 9)" "type = real\\\(kind=4\\\)" \
+gdb_test "ptype pvla(3, 6, 9)" "type = $real" \
   "ptype pvla(3, 6, 9)"
 
 gdb_breakpoint [gdb_get_line_number "pvla-re-associated"]
 gdb_continue_to_breakpoint "pvla-re-associated"
-gdb_test "ptype pvla" "type = real\\\(kind=4\\\) \\\(7,42:50,13:35\\\)" \
+gdb_test "ptype pvla" "type = $real \\\(7,42:50,13:35\\\)" \
   "ptype pvla re-associated"
-gdb_test "ptype vla2(5, 45, 20)" "type = real\\\(kind=4\\\)" \
+gdb_test "ptype vla2(5, 45, 20)" "type = $real" \
   "ptype vla1(5, 45, 20) re-associated"
 
 gdb_breakpoint [gdb_get_line_number "pvla-deassociated"]
diff --git a/gdb/testsuite/gdb.fortran/whatis_type.exp b/gdb/testsuite/gdb.fortran/whatis_type.exp
index b0e37e6..5f913c1 100644
--- a/gdb/testsuite/gdb.fortran/whatis_type.exp
+++ b/gdb/testsuite/gdb.fortran/whatis_type.exp
@@ -16,6 +16,7 @@
 if { [skip_fortran_tests] } { continue }
 
 standard_testfile type.f90
+load_lib "fortran.exp"
 
 if { [prepare_for_testing ${testfile}.exp ${testfile} \
                           ${srcfile} {debug f90}] } {
@@ -30,8 +31,8 @@ if ![runto MAIN__] {
 gdb_breakpoint [gdb_get_line_number "bp1"]
 gdb_continue_to_breakpoint "bp1"
 
-set t1_i "integer\\\(kind=4\\\) :: t1_i"
-set t1_r "real\\\(kind=4\\\) :: t1_r"
+set t1_i "$int :: t1_i"
+set t1_r "$real :: t1_r"
 
 gdb_test "whatis t1" \
   "type = Type t1\r\n${t1_i}\r\n${t1_r}\r\nEnd Type t1" \
diff --git a/gdb/testsuite/lib/fortran.exp b/gdb/testsuite/lib/fortran.exp
index 04011b9..ae1d583 100644
--- a/gdb/testsuite/lib/fortran.exp
+++ b/gdb/testsuite/lib/fortran.exp
@@ -28,3 +28,91 @@ proc set_lang_fortran {} {
     }
     return 1
 }
+
+proc fortran_int4 {} {
+    if {[test_compiler_info {gcc-4-[012]-*}]} {
+	return "int4"
+    } elseif {[test_compiler_info {gcc-*}]} {
+	return "integer\\(kind=4\\)"
+    } elseif {[test_compiler_info {icc-*}]} {
+	return "INTEGER\\(4\\)"
+    } else {
+	return "unknown"
+    }
+}
+
+proc fortran_real4 {} {
+    if {[test_compiler_info {gcc-4-[012]-*}]} {
+	return "real4"
+    } elseif {[test_compiler_info {gcc-*}]} {
+	return "real\\(kind=4\\)"
+    } elseif {[test_compiler_info {icc-*}]} {
+	return "REAL\\(4\\)"
+    } else {
+	return "unknown"
+    }
+}
+
+proc fortran_real8 {} {
+    if {[test_compiler_info {gcc-4-[012]-*}]} {
+	return "real8"
+    } elseif {[test_compiler_info {gcc-*}]} {
+	return "real\\(kind=8\\)"
+    } elseif {[test_compiler_info {icc-*}]} {
+	return "REAL\\(8\\)"
+    } else {
+	return "unknown"
+    }
+}
+
+proc fortran_complex4 {} {
+    if {[test_compiler_info {gcc-4-[012]-*}]} {
+	return "complex4"
+    } elseif {[test_compiler_info {gcc-*}]} {
+	return "complex\\(kind=4\\)"
+    } elseif {[test_compiler_info {icc-*}]} {
+	return "COMPLEX\\(4\\)"
+    } else {
+	return "unknown"
+    }
+}
+
+proc fortran_logical4 {} {
+    if {[test_compiler_info {gcc-4-[012]-*}]} {
+	return "logical4"
+    } elseif {[test_compiler_info {gcc-*}]} {
+	return "logical\\(kind=4\\)"
+    } elseif {[test_compiler_info {icc-*}]} {
+	return "LOGICAL\\(4\\)"
+    } else {
+	return "unknown"
+    }
+}
+
+if ![info exists int4] then {
+    set int4 [fortran_int4]
+}
+if ![info exists real4] then {
+    set real4 [fortran_real4]
+}
+if ![info exists real8] then {
+    set real8 [fortran_real8]
+}
+if ![info exists complex4] then {
+    set complex4 [fortran_complex4]
+}
+if ![info exists logical4] then {
+    set logical4 [fortran_logical4]
+}
+if ![info exists int] then {
+    set int $int4
+}
+if ![info exists real] then {
+    set real $real4
+}
+if ![info exists complex] then {
+    set complex $complex4
+}
+if ![info exists logical] then {
+    set logical $logical4
+}
-- 
2.7.1.339.g0233b80

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

* Re: [PATCH V2 2/2] fortran: Testsuite, fix different type naming across compilers.
  2016-04-15 12:47 ` [PATCH V2 2/2] fortran: Testsuite, fix different type naming across compilers Bernhard Heckel
@ 2016-04-15 14:41   ` Yao Qi
  2016-04-18  7:15     ` Heckel, Bernhard
  0 siblings, 1 reply; 8+ messages in thread
From: Yao Qi @ 2016-04-15 14:41 UTC (permalink / raw)
  To: Bernhard Heckel; +Cc: qiyaoltc, gdb-patches, brobecker

Bernhard Heckel <bernhard.heckel@intel.com> writes:

> -# Depending on the compiler version being used, the name of the 4-byte integer
> -# and real types can be printed differently.  For instance, gfortran-4.1 uses
> -# "int4" whereas gfortran-4.3 uses "int(kind=4)".
> -set int4 "(int4|integer\\(kind=4\\))"
> -set real4 "(real4|real\\(kind=4\\))"
> -
> -gdb_test "ptype p" "type = Type bar\r\n *${int4} :: c\r\n *${real4} :: d\r\n *End Type bar"
> +gdb_test "ptype p" "type = Type bar\r\n *$int :: c\r\n *$real :: d\r\n *End Type bar"


> +
> +proc fortran_int4 {} {
> +    if {[test_compiler_info {gcc-4-[012]-*}]} {
> +	return "int4"
> +    } elseif {[test_compiler_info {gcc-*}]} {
> +	return "integer\\(kind=4\\)"
> +    } elseif {[test_compiler_info {icc-*}]} {
> +	return "INTEGER\\(4\\)"
> +    } else {
> +	return "unknown"
> +    }
> +}
> +

> +
> +if ![info exists int4] then {
> +    set int4 [fortran_int4]
> +}

Why do you prefer to define these info?  In each test, we can do

set int4 [fortran_int4],

IMO, that is much cleaner than your current approach (define int4
globally in lib/fortran.exp and use it everywhere).

-- 
Yao (齐尧)

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

* Re: [PATCH V2 1/2] testsuite: Support detection of Intel compilers via test_compiler_version.
  2016-04-15 12:47 ` [PATCH V2 1/2] testsuite: Support detection of Intel compilers via test_compiler_version Bernhard Heckel
@ 2016-04-15 15:00   ` Yao Qi
  2016-04-18  6:26     ` Heckel, Bernhard
  0 siblings, 1 reply; 8+ messages in thread
From: Yao Qi @ 2016-04-15 15:00 UTC (permalink / raw)
  To: Bernhard Heckel; +Cc: qiyaoltc, gdb-patches, brobecker

Bernhard Heckel <bernhard.heckel@intel.com> writes:

> Add Intel specific preprocessor macros to query the version of the compiler.
>

Looks you query the version of c/c++ compiler, and use it for fortran.
Can we assume that fortran compiler's version is the same as the c/c++
compiler version?  In an extreme case, user can set c compiler to icc,
and set fortran compiler to gfortran.

Looks we've already had such assumption in ada, that is, we determine
ada compiler version by the c compiler, so I am OK to do the same for
fortran.

> --- a/gdb/testsuite/lib/compiler.cc
> +++ b/gdb/testsuite/lib/compiler.cc
> @@ -44,3 +44,15 @@ set compiler_info [join {armcc __ARMCC_VERSION} -]
>  #if defined (__clang__)
>  set compiler_info [join {clang __clang_major__ __clang_minor__ __clang_patchlevel__} -]
>  #endif
> +
> +#if defined (__ICC)
> +set icc_major [string range __ICC 0 1]
> +set icc_minor [format "%d" [string range __ICC 2 [expr {[string length __ICC] -1}]]]
> +set icc_update __INTEL_COMPILER_UPDATE
> +set compiler_info [join "icc $icc_major $icc_minor $icc_update" -]
> +#elif defined (__ICL)
> +set icc_major [string range __ICL 0 1]
> +set icc_minor [format "%d" [string range __ICL 2 [expr {[string length __ICL] -1}]]]
> +set icc_update __INTEL_COMPILER_UPDATE
> +set compiler_info [join "icc $icc_major $icc_minor $icc_update" -]
> +#endif

Do we really need the change to compiler.cc?  Since we query the info of
compilers for different languages through c compiler, we don't need the
change compiler.cc unless we need to know the compiler info in some c++
tests.

> diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
> index 1ef6a96..75c5e68 100644
> --- a/gdb/testsuite/lib/gdb.exp
> +++ b/gdb/testsuite/lib/gdb.exp
> @@ -3553,6 +3553,9 @@ proc gdb_compile_shlib {sources dest options} {
>                  lappend obj_options "additional_flags=-fpic"
>              }
>          }
> +        "icc-*" {
> +                lappend obj_options "additional_flags=-fpic"
> +        }

Why do we need this change?  How is it related to this patch series?

-- 
Yao (齐尧)

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

* Re: [PATCH V2 1/2] testsuite: Support detection of Intel compilers via test_compiler_version.
  2016-04-15 15:00   ` Yao Qi
@ 2016-04-18  6:26     ` Heckel, Bernhard
  2016-04-18  9:29       ` Yao Qi
  0 siblings, 1 reply; 8+ messages in thread
From: Heckel, Bernhard @ 2016-04-18  6:26 UTC (permalink / raw)
  To: Yao Qi; +Cc: gdb-patches, brobecker

On 15/04/2016 16:59, Yao Qi wrote:
> Bernhard Heckel <bernhard.heckel@intel.com> writes:
>
>> Add Intel specific preprocessor macros to query the version of the compiler.
>>
> Looks you query the version of c/c++ compiler, and use it for fortran.
> Can we assume that fortran compiler's version is the same as the c/c++
> compiler version?  In an extreme case, user can set c compiler to icc,
> and set fortran compiler to gfortran.
>
> Looks we've already had such assumption in ada, that is, we determine
> ada compiler version by the c compiler, so I am OK to do the same for
> fortran.
>
>> --- a/gdb/testsuite/lib/compiler.cc
>> +++ b/gdb/testsuite/lib/compiler.cc
>> @@ -44,3 +44,15 @@ set compiler_info [join {armcc __ARMCC_VERSION} -]
>>   #if defined (__clang__)
>>   set compiler_info [join {clang __clang_major__ __clang_minor__ __clang_patchlevel__} -]
>>   #endif
>> +
>> +#if defined (__ICC)
>> +set icc_major [string range __ICC 0 1]
>> +set icc_minor [format "%d" [string range __ICC 2 [expr {[string length __ICC] -1}]]]
>> +set icc_update __INTEL_COMPILER_UPDATE
>> +set compiler_info [join "icc $icc_major $icc_minor $icc_update" -]
>> +#elif defined (__ICL)
>> +set icc_major [string range __ICL 0 1]
>> +set icc_minor [format "%d" [string range __ICL 2 [expr {[string length __ICL] -1}]]]
>> +set icc_update __INTEL_COMPILER_UPDATE
>> +set compiler_info [join "icc $icc_major $icc_minor $icc_update" -]
>> +#endif
> Do we really need the change to compiler.cc?  Since we query the info of
> compilers for different languages through c compiler, we don't need the
> change compiler.cc unless we need to know the compiler info in some c++
> tests.
get_compiler_info can be used with "c++" as argument. Even if 
test_compiler_info always uses "c"
I would like to have this completed.
>
>> diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
>> index 1ef6a96..75c5e68 100644
>> --- a/gdb/testsuite/lib/gdb.exp
>> +++ b/gdb/testsuite/lib/gdb.exp
>> @@ -3553,6 +3553,9 @@ proc gdb_compile_shlib {sources dest options} {
>>                   lappend obj_options "additional_flags=-fpic"
>>               }
>>           }
>> +        "icc-*" {
>> +                lappend obj_options "additional_flags=-fpic"
>> +        }
> Why do we need this change?  How is it related to this patch series?
ICC was handled in the testsuite like GCC before, including the flags 
for compiling shared libraries.
If not set, compiling gdb.fortran/library-module-lib.f90 will fail.

Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Christian Lamprechter
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928

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

* Re: [PATCH V2 2/2] fortran: Testsuite, fix different type naming across compilers.
  2016-04-15 14:41   ` Yao Qi
@ 2016-04-18  7:15     ` Heckel, Bernhard
  0 siblings, 0 replies; 8+ messages in thread
From: Heckel, Bernhard @ 2016-04-18  7:15 UTC (permalink / raw)
  To: Yao Qi; +Cc: gdb-patches, brobecker

On 15/04/2016 16:41, Yao Qi wrote:
> Bernhard Heckel <bernhard.heckel@intel.com> writes:
>
>> -# Depending on the compiler version being used, the name of the 4-byte integer
>> -# and real types can be printed differently.  For instance, gfortran-4.1 uses
>> -# "int4" whereas gfortran-4.3 uses "int(kind=4)".
>> -set int4 "(int4|integer\\(kind=4\\))"
>> -set real4 "(real4|real\\(kind=4\\))"
>> -
>> -gdb_test "ptype p" "type = Type bar\r\n *${int4} :: c\r\n *${real4} :: d\r\n *End Type bar"
>> +gdb_test "ptype p" "type = Type bar\r\n *$int :: c\r\n *$real :: d\r\n *End Type bar"
>
>> +
>> +proc fortran_int4 {} {
>> +    if {[test_compiler_info {gcc-4-[012]-*}]} {
>> +	return "int4"
>> +    } elseif {[test_compiler_info {gcc-*}]} {
>> +	return "integer\\(kind=4\\)"
>> +    } elseif {[test_compiler_info {icc-*}]} {
>> +	return "INTEGER\\(4\\)"
>> +    } else {
>> +	return "unknown"
>> +    }
>> +}
>> +
>> +
>> +if ![info exists int4] then {
>> +    set int4 [fortran_int4]
>> +}
> Why do you prefer to define these info?  In each test, we can do
>
> set int4 [fortran_int4],
>
> IMO, that is much cleaner than your current approach (define int4
> globally in lib/fortran.exp and use it everywhere).
>
I wanted to avoid copy in the same code in several testcases but when I 
look again, it's
better to get rid of the globals here.
Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Christian Lamprechter
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928

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

* Re: [PATCH V2 1/2] testsuite: Support detection of Intel compilers via test_compiler_version.
  2016-04-18  6:26     ` Heckel, Bernhard
@ 2016-04-18  9:29       ` Yao Qi
  0 siblings, 0 replies; 8+ messages in thread
From: Yao Qi @ 2016-04-18  9:29 UTC (permalink / raw)
  To: Heckel, Bernhard; +Cc: Yao Qi, gdb-patches, brobecker

"Heckel, Bernhard" <bernhard.heckel@intel.com> writes:

>>> diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
>>> index 1ef6a96..75c5e68 100644
>>> --- a/gdb/testsuite/lib/gdb.exp
>>> +++ b/gdb/testsuite/lib/gdb.exp
>>> @@ -3553,6 +3553,9 @@ proc gdb_compile_shlib {sources dest options} {
>>>                   lappend obj_options "additional_flags=-fpic"
>>>               }
>>>           }
>>> +        "icc-*" {
>>> +                lappend obj_options "additional_flags=-fpic"
>>> +        }
>> Why do we need this change?  How is it related to this patch series?
> ICC was handled in the testsuite like GCC before, including the flags
> for compiling shared libraries.
> If not set, compiling gdb.fortran/library-module-lib.f90 will fail.

This change affects all the shared lib tests compiled by icc.  It should
be in another patch.

-- 
Yao (齐尧)

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

end of thread, other threads:[~2016-04-18  9:29 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-15 12:46 [PATCH V2 0/2] fortran: Testsuite, fix different type naming across compilers Bernhard Heckel
2016-04-15 12:47 ` [PATCH V2 1/2] testsuite: Support detection of Intel compilers via test_compiler_version Bernhard Heckel
2016-04-15 15:00   ` Yao Qi
2016-04-18  6:26     ` Heckel, Bernhard
2016-04-18  9:29       ` Yao Qi
2016-04-15 12:47 ` [PATCH V2 2/2] fortran: Testsuite, fix different type naming across compilers Bernhard Heckel
2016-04-15 14:41   ` Yao Qi
2016-04-18  7:15     ` Heckel, Bernhard

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).