Jan Kratochvil 7306e88
From f63782d25ebd593c4c4669d4c394a2706f15e660 Mon Sep 17 00:00:00 2001
Jan Kratochvil 7306e88
From: Bernhard Heckel <bernhard.heckel@intel.com>
Jan Kratochvil 7306e88
Date: Tue, 12 Jul 2016 08:19:34 +0200
Jan Kratochvil 7306e88
Subject: [PATCH 4/7] Fortran: Typeprint, fix dangling types.
Jan Kratochvil 7306e88
Jan Kratochvil 7306e88
Show the type of not-allocated and/or not-associated types
Jan Kratochvil 7306e88
as this is known.  For array types and pointer to array types
Jan Kratochvil 7306e88
we are going to print the number of ranks.
Jan Kratochvil 7306e88
Jan Kratochvil 7306e88
2016-06-30  Bernhard Heckel  <bernhard.heckel@intel.com>
Jan Kratochvil 7306e88
Jan Kratochvil 7306e88
gdb/ChangeLog:
Jan Kratochvil 7306e88
	* f-typeprint.c (f_print_type): Don't bypass dangling types.
Jan Kratochvil 7306e88
	  (f_type_print_varspec_suffix): Add print_rank parameter.
Jan Kratochvil 7306e88
	  (f_type_print_varspec_suffix): Print ranks of array types
Jan Kratochvil 7306e88
	  in case they dangling.
Jan Kratochvil 7306e88
	  (f_type_print_base): Add print_rank parameter.
Jan Kratochvil 7306e88
Jan Kratochvil 7306e88
gdb/Testsuite/ChangeLog:
Jan Kratochvil 7306e88
	* gdb.fortran/pointers.f90: New.
Jan Kratochvil 7306e88
	* gdb.fortran/print_type.exp: New.
Jan Kratochvil 7306e88
	* gdb.fortran/vla-ptype.exp: Adapt expected results.
Jan Kratochvil 7306e88
	* gdb.fortran/vla-type.exp: Likewise.
Jan Kratochvil 7306e88
	* gdb.fortran/vla-value.exp: Likewise.
Jan Kratochvil 7306e88
	* gdb.mi/mi-vla-fortran.exp: Likewise.
Jan Kratochvil 7306e88
Jan Kratochvil 7306e88
Change-Id: Ib55f28b4092cf88e34918449a2ebb6e5daafe512
Jan Kratochvil 7306e88
---
Jan Kratochvil 7306e88
 gdb/f-typeprint.c                        |  95 +++++++++++++++--------------
Jan Kratochvil 7306e88
 gdb/testsuite/gdb.fortran/pointers.f90   |  80 +++++++++++++++++++++++++
Jan Kratochvil 7306e88
 gdb/testsuite/gdb.fortran/print_type.exp | 100 +++++++++++++++++++++++++++++++
Jan Kratochvil 7306e88
 gdb/testsuite/gdb.fortran/vla-ptype.exp  |  12 ++--
Jan Kratochvil 7306e88
 gdb/testsuite/gdb.fortran/vla-type.exp   |   7 ++-
Jan Kratochvil 7306e88
 gdb/testsuite/gdb.fortran/vla-value.exp  |   4 +-
Jan Kratochvil 7306e88
 gdb/testsuite/gdb.mi/mi-vla-fortran.exp  |   9 +--
Jan Kratochvil 7306e88
 7 files changed, 248 insertions(+), 59 deletions(-)
Jan Kratochvil 7306e88
 create mode 100644 gdb/testsuite/gdb.fortran/pointers.f90
Jan Kratochvil 7306e88
 create mode 100755 gdb/testsuite/gdb.fortran/print_type.exp
Jan Kratochvil 7306e88
Jan Kratochvil 7306e88
Index: gdb-7.11.50.20160630/gdb/f-typeprint.c
Jan Kratochvil 7306e88
===================================================================
Jan Kratochvil 7306e88
--- gdb-7.11.50.20160630.orig/gdb/f-typeprint.c	2016-07-16 10:54:48.749099150 +0200
Jan Kratochvil 7306e88
+++ gdb-7.11.50.20160630/gdb/f-typeprint.c	2016-07-16 10:55:59.763667355 +0200
Jan Kratochvil 7306e88
@@ -37,7 +37,7 @@
Jan Kratochvil 7306e88
 #endif
Jan Kratochvil 7306e88
 
Jan Kratochvil 7306e88
 static void f_type_print_varspec_suffix (struct type *, struct ui_file *, int,
Jan Kratochvil 7306e88
-					 int, int, int);
Jan Kratochvil 7306e88
+					 int, int, int, int);
Jan Kratochvil 7306e88
 
Jan Kratochvil 7306e88
 void f_type_print_varspec_prefix (struct type *, struct ui_file *,
Jan Kratochvil 7306e88
 				  int, int);
Jan Kratochvil 7306e88
@@ -54,18 +54,6 @@
Jan Kratochvil 7306e88
   enum type_code code;
Jan Kratochvil 7306e88
   int demangled_args;
Jan Kratochvil 7306e88
 
Jan Kratochvil 7306e88
-  if (type_not_associated (type))
Jan Kratochvil 7306e88
-    {
Jan Kratochvil 7306e88
-      val_print_not_associated (stream);
Jan Kratochvil 7306e88
-      return;
Jan Kratochvil 7306e88
-    }
Jan Kratochvil 7306e88
-
Jan Kratochvil 7306e88
-  if (type_not_allocated (type))
Jan Kratochvil 7306e88
-    {
Jan Kratochvil 7306e88
-      val_print_not_allocated (stream);
Jan Kratochvil 7306e88
-      return;
Jan Kratochvil 7306e88
-    }
Jan Kratochvil 7306e88
-
Jan Kratochvil 7306e88
   f_type_print_base (type, stream, show, level);
Jan Kratochvil 7306e88
   code = TYPE_CODE (type);
Jan Kratochvil 7306e88
   if ((varstring != NULL && *varstring != '\0')
Jan Kratochvil 7306e88
@@ -87,7 +75,7 @@
Jan Kratochvil 7306e88
          so don't print an additional pair of ()'s.  */
Jan Kratochvil 7306e88
 
Jan Kratochvil 7306e88
       demangled_args = varstring[strlen (varstring) - 1] == ')'; 
Jan Kratochvil 7306e88
-      f_type_print_varspec_suffix (type, stream, show, 0, demangled_args, 0);
Jan Kratochvil 7306e88
+      f_type_print_varspec_suffix (type, stream, show, 0, demangled_args, 0, 0);
Jan Kratochvil 7306e88
    }
Jan Kratochvil 7306e88
 }
Jan Kratochvil 7306e88
 
Jan Kratochvil 7306e88
@@ -157,7 +145,7 @@
Jan Kratochvil 7306e88
 static void
Jan Kratochvil 7306e88
 f_type_print_varspec_suffix (struct type *type, struct ui_file *stream,
Jan Kratochvil 7306e88
 			     int show, int passed_a_ptr, int demangled_args,
Jan Kratochvil 7306e88
-			     int arrayprint_recurse_level)
Jan Kratochvil 7306e88
+			     int arrayprint_recurse_level, int print_rank_only)
Jan Kratochvil 7306e88
 {
Jan Kratochvil 7306e88
   int upper_bound, lower_bound;
Jan Kratochvil 7306e88
 
Jan Kratochvil 7306e88
@@ -181,34 +169,50 @@
Jan Kratochvil 7306e88
 	fprintf_filtered (stream, "(");
Jan Kratochvil 7306e88
 
Jan Kratochvil 7306e88
       if (type_not_associated (type))
Jan Kratochvil 7306e88
-        val_print_not_associated (stream);
Jan Kratochvil 7306e88
+	print_rank_only = 1;
Jan Kratochvil 7306e88
       else if (type_not_allocated (type))
Jan Kratochvil 7306e88
-        val_print_not_allocated (stream);
Jan Kratochvil 7306e88
+	print_rank_only = 1;
Jan Kratochvil 7306e88
+      else if ((TYPE_ASSOCIATED_PROP (type)
Jan Kratochvil 7306e88
+		&& PROP_CONST != TYPE_DYN_PROP_KIND (TYPE_ASSOCIATED_PROP (type)))
Jan Kratochvil 7306e88
+	      || (TYPE_ALLOCATED_PROP (type)
Jan Kratochvil 7306e88
+		&& PROP_CONST != TYPE_DYN_PROP_KIND (TYPE_ALLOCATED_PROP (type)))
Jan Kratochvil 7306e88
+	      || (TYPE_DATA_LOCATION (type)
Jan Kratochvil 7306e88
+		  && PROP_CONST != TYPE_DYN_PROP_KIND (TYPE_DATA_LOCATION (type))))
Jan Kratochvil 7306e88
+	/* This case exist when we ptype a typename which has the
Jan Kratochvil 7306e88
+	   dynamic properties but cannot be resolved as there is
Jan Kratochvil 7306e88
+	   no object.  */
Jan Kratochvil 7306e88
+	print_rank_only = 1;
Jan Kratochvil 7306e88
+
Jan Kratochvil 7306e88
+      if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_ARRAY)
Jan Kratochvil 7306e88
+	f_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0,
Jan Kratochvil 7306e88
+				     0, 0, arrayprint_recurse_level,
Jan Kratochvil 7306e88
+				     print_rank_only);
Jan Kratochvil 7306e88
+
Jan Kratochvil 7306e88
+      if (print_rank_only == 1)
Jan Kratochvil 7306e88
+	fprintf_filtered (stream, ":");
Jan Kratochvil 7306e88
       else
Jan Kratochvil 7306e88
-        {
Jan Kratochvil 7306e88
-          if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_ARRAY)
Jan Kratochvil 7306e88
-            f_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0,
Jan Kratochvil 7306e88
-                                        0, 0, arrayprint_recurse_level);
Jan Kratochvil 7306e88
-
Jan Kratochvil 7306e88
-          lower_bound = f77_get_lowerbound (type);
Jan Kratochvil 7306e88
-          if (lower_bound != 1)	/* Not the default.  */
Jan Kratochvil 7306e88
-            fprintf_filtered (stream, "%d:", lower_bound);
Jan Kratochvil 7306e88
-
Jan Kratochvil 7306e88
-          /* Make sure that, if we have an assumed size array, we
Jan Kratochvil 7306e88
-             print out a warning and print the upperbound as '*'.  */
Jan Kratochvil 7306e88
-
Jan Kratochvil 7306e88
-          if (TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type))
Jan Kratochvil 7306e88
-            fprintf_filtered (stream, "*");
Jan Kratochvil 7306e88
-          else
Jan Kratochvil 7306e88
-            {
Jan Kratochvil 7306e88
-              upper_bound = f77_get_upperbound (type);
Jan Kratochvil 7306e88
-              fprintf_filtered (stream, "%d", upper_bound);
Jan Kratochvil 7306e88
-            }
Jan Kratochvil 7306e88
-
Jan Kratochvil 7306e88
-          if (TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_ARRAY)
Jan Kratochvil 7306e88
-            f_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0,
Jan Kratochvil 7306e88
-                                        0, 0, arrayprint_recurse_level);
Jan Kratochvil 7306e88
-        }
Jan Kratochvil 7306e88
+	{
Jan Kratochvil 7306e88
+	  lower_bound = f77_get_lowerbound (type);
Jan Kratochvil 7306e88
+	  if (lower_bound != 1)	/* Not the default.  */
Jan Kratochvil 7306e88
+	    fprintf_filtered (stream, "%d:", lower_bound);
Jan Kratochvil 7306e88
+
Jan Kratochvil 7306e88
+	  /* Make sure that, if we have an assumed size array, we
Jan Kratochvil 7306e88
+	     print out a warning and print the upperbound as '*'.  */
Jan Kratochvil 7306e88
+
Jan Kratochvil 7306e88
+	  if (TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type))
Jan Kratochvil 7306e88
+	    fprintf_filtered (stream, "*");
Jan Kratochvil 7306e88
+	  else
Jan Kratochvil 7306e88
+	    {
Jan Kratochvil 7306e88
+	      upper_bound = f77_get_upperbound (type);
Jan Kratochvil 7306e88
+	      fprintf_filtered (stream, "%d", upper_bound);
Jan Kratochvil 7306e88
+	    }
Jan Kratochvil 7306e88
+	}
Jan Kratochvil 7306e88
+
Jan Kratochvil 7306e88
+      if (TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_ARRAY)
Jan Kratochvil 7306e88
+	f_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0,
Jan Kratochvil 7306e88
+				     0, 0, arrayprint_recurse_level,
Jan Kratochvil 7306e88
+				     print_rank_only);
Jan Kratochvil 7306e88
+
Jan Kratochvil 7306e88
       if (arrayprint_recurse_level == 1)
Jan Kratochvil 7306e88
 	fprintf_filtered (stream, ")");
Jan Kratochvil 7306e88
       else
Jan Kratochvil 7306e88
@@ -219,13 +223,14 @@
Jan Kratochvil 7306e88
     case TYPE_CODE_PTR:
Jan Kratochvil 7306e88
     case TYPE_CODE_REF:
Jan Kratochvil 7306e88
       f_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, 1, 0,
Jan Kratochvil 7306e88
-				   arrayprint_recurse_level);
Jan Kratochvil 7306e88
+				   arrayprint_recurse_level, 0);
Jan Kratochvil 7306e88
       fprintf_filtered (stream, ")");
Jan Kratochvil 7306e88
       break;
Jan Kratochvil 7306e88
 
Jan Kratochvil 7306e88
     case TYPE_CODE_FUNC:
Jan Kratochvil 7306e88
       f_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0,
Jan Kratochvil 7306e88
-				   passed_a_ptr, 0, arrayprint_recurse_level);
Jan Kratochvil 7306e88
+				   passed_a_ptr, 0, arrayprint_recurse_level,
Jan Kratochvil 7306e88
+				   0);
Jan Kratochvil 7306e88
       if (passed_a_ptr)
Jan Kratochvil 7306e88
 	fprintf_filtered (stream, ")");
Jan Kratochvil 7306e88
 
Jan Kratochvil 7306e88
@@ -376,7 +381,7 @@
Jan Kratochvil 7306e88
 	      fputs_filtered (" :: ", stream);
Jan Kratochvil 7306e88
 	      fputs_filtered (TYPE_FIELD_NAME (type, index), stream);
Jan Kratochvil 7306e88
 	      f_type_print_varspec_suffix (TYPE_FIELD_TYPE (type, index),
Jan Kratochvil 7306e88
-					   stream, show - 1, 0, 0, 0);
Jan Kratochvil 7306e88
+					   stream, show - 1, 0, 0, 0, 0);
Jan Kratochvil 7306e88
 	      fputs_filtered ("\n", stream);
Jan Kratochvil 7306e88
 	    }
Jan Kratochvil 7306e88
 	  fprintfi_filtered (level, stream, "End Type ");
Jan Kratochvil 7306e88
Index: gdb-7.11.50.20160630/gdb/testsuite/gdb.fortran/pointers.f90
Jan Kratochvil 7306e88
===================================================================
Jan Kratochvil 7306e88
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
Jan Kratochvil 7306e88
+++ gdb-7.11.50.20160630/gdb/testsuite/gdb.fortran/pointers.f90	2016-07-16 10:55:42.079525860 +0200
Jan Kratochvil 7306e88
@@ -0,0 +1,80 @@
Jan Kratochvil 7306e88
+! Copyright 2016 Free Software Foundation, Inc.
Jan Kratochvil 7306e88
+!
Jan Kratochvil 7306e88
+! This program is free software; you can redistribute it and/or modify
Jan Kratochvil 7306e88
+! it under the terms of the GNU General Public License as published by
Jan Kratochvil 7306e88
+! the Free Software Foundation; either version 3 of the License, or
Jan Kratochvil 7306e88
+! (at your option) any later version.
Jan Kratochvil 7306e88
+!
Jan Kratochvil 7306e88
+! This program is distributed in the hope that it will be useful,
Jan Kratochvil 7306e88
+! but WITHOUT ANY WARRANTY; without even the implied warranty of
Jan Kratochvil 7306e88
+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Jan Kratochvil 7306e88
+! GNU General Public License for more details.
Jan Kratochvil 7306e88
+!
Jan Kratochvil 7306e88
+! You should have received a copy of the GNU General Public License
Jan Kratochvil 7306e88
+! along with this program.  If not, see <http://www.gnu.org/licenses/>.
Jan Kratochvil 7306e88
+
Jan Kratochvil 7306e88
+program pointers
Jan Kratochvil 7306e88
+
Jan Kratochvil 7306e88
+  type :: two
Jan Kratochvil 7306e88
+    integer, allocatable :: ivla1 (:)
Jan Kratochvil 7306e88
+    integer, allocatable :: ivla2 (:, :)
Jan Kratochvil 7306e88
+  end type two
Jan Kratochvil 7306e88
+
Jan Kratochvil 7306e88
+  logical, target :: logv
Jan Kratochvil 7306e88
+  complex, target :: comv
Jan Kratochvil 7306e88
+  character, target :: charv
Jan Kratochvil 7306e88
+  character (len=3), target :: chara
Jan Kratochvil 7306e88
+  integer, target :: intv
Jan Kratochvil 7306e88
+  integer, target, dimension (10,2) :: inta
Jan Kratochvil 7306e88
+  real, target    :: realv
Jan Kratochvil 7306e88
+  type(two), target  :: twov
Jan Kratochvil 7306e88
+
Jan Kratochvil 7306e88
+  logical, pointer :: logp
Jan Kratochvil 7306e88
+  complex, pointer :: comp
Jan Kratochvil 7306e88
+  character, pointer:: charp
Jan Kratochvil 7306e88
+  character (len=3), pointer:: charap
Jan Kratochvil 7306e88
+  integer, pointer :: intp
Jan Kratochvil 7306e88
+  integer, pointer, dimension (:,:) :: intap
Jan Kratochvil 7306e88
+  real, pointer :: realp
Jan Kratochvil 7306e88
+  type(two), pointer :: twop
Jan Kratochvil 7306e88
+
Jan Kratochvil 7306e88
+  nullify (logp)
Jan Kratochvil 7306e88
+  nullify (comp)
Jan Kratochvil 7306e88
+  nullify (charp)
Jan Kratochvil 7306e88
+  nullify (charap)
Jan Kratochvil 7306e88
+  nullify (intp)
Jan Kratochvil 7306e88
+  nullify (intap)
Jan Kratochvil 7306e88
+  nullify (realp)
Jan Kratochvil 7306e88
+  nullify (twop)
Jan Kratochvil 7306e88
+
Jan Kratochvil 7306e88
+  logp => logv    ! Before pointer assignment
Jan Kratochvil 7306e88
+  comp => comv
Jan Kratochvil 7306e88
+  charp => charv
Jan Kratochvil 7306e88
+  charap => chara
Jan Kratochvil 7306e88
+  intp => intv
Jan Kratochvil 7306e88
+  intap => inta
Jan Kratochvil 7306e88
+  realp => realv
Jan Kratochvil 7306e88
+  twop => twov
Jan Kratochvil 7306e88
+
Jan Kratochvil 7306e88
+  logv = associated(logp)     ! Before value assignment
Jan Kratochvil 7306e88
+  comv = cmplx(1,2)
Jan Kratochvil 7306e88
+  charv = "a"
Jan Kratochvil 7306e88
+  chara = "abc"
Jan Kratochvil 7306e88
+  intv = 10
Jan Kratochvil 7306e88
+  inta(:,:) = 1
Jan Kratochvil 7306e88
+  inta(3,1) = 3
Jan Kratochvil 7306e88
+  realv = 3.14
Jan Kratochvil 7306e88
+
Jan Kratochvil 7306e88
+  allocate (twov%ivla1(3))
Jan Kratochvil 7306e88
+  allocate (twov%ivla2(2,2))
Jan Kratochvil 7306e88
+  twov%ivla1(1) = 11
Jan Kratochvil 7306e88
+  twov%ivla1(2) = 12
Jan Kratochvil 7306e88
+  twov%ivla1(3) = 13
Jan Kratochvil 7306e88
+  twov%ivla2(1,1) = 211
Jan Kratochvil 7306e88
+  twov%ivla2(2,1) = 221
Jan Kratochvil 7306e88
+  twov%ivla2(1,2) = 212
Jan Kratochvil 7306e88
+  twov%ivla2(2,2) = 222
Jan Kratochvil 7306e88
+
Jan Kratochvil 7306e88
+  intv = intv + 1 ! After value assignment
Jan Kratochvil 7306e88
+
Jan Kratochvil 7306e88
+end program pointers
Jan Kratochvil 7306e88
Index: gdb-7.11.50.20160630/gdb/testsuite/gdb.fortran/print_type.exp
Jan Kratochvil 7306e88
===================================================================
Jan Kratochvil 7306e88
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
Jan Kratochvil 7306e88
+++ gdb-7.11.50.20160630/gdb/testsuite/gdb.fortran/print_type.exp	2016-07-16 10:55:42.079525860 +0200
Jan Kratochvil 7306e88
@@ -0,0 +1,100 @@
Jan Kratochvil 7306e88
+# Copyright 2016 Free Software Foundation, Inc.
Jan Kratochvil 7306e88
+
Jan Kratochvil 7306e88
+# This program is free software; you can redistribute it and/or modify
Jan Kratochvil 7306e88
+# it under the terms of the GNU General Public License as published by
Jan Kratochvil 7306e88
+# the Free Software Foundation; either version 3 of the License, or
Jan Kratochvil 7306e88
+# (at your option) any later version.
Jan Kratochvil 7306e88
+#
Jan Kratochvil 7306e88
+# This program is distributed in the hope that it will be useful,
Jan Kratochvil 7306e88
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
Jan Kratochvil 7306e88
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Jan Kratochvil 7306e88
+# GNU General Public License for more details.
Jan Kratochvil 7306e88
+#
Jan Kratochvil 7306e88
+# You should have received a copy of the GNU General Public License
Jan Kratochvil 7306e88
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
Jan Kratochvil 7306e88
+
Jan Kratochvil 7306e88
+standard_testfile "pointers.f90"
Jan Kratochvil 7306e88
+load_lib fortran.exp
Jan Kratochvil 7306e88
+
Jan Kratochvil 7306e88
+if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
Jan Kratochvil 7306e88
+    {debug f90 quiet}] } {
Jan Kratochvil 7306e88
+    return -1
Jan Kratochvil 7306e88
+}
Jan Kratochvil 7306e88
+
Jan Kratochvil 7306e88
+
Jan Kratochvil 7306e88
+if ![runto_main] {
Jan Kratochvil 7306e88
+    untested "could not run to main"
Jan Kratochvil 7306e88
+    return -1
Jan Kratochvil 7306e88
+}
Jan Kratochvil 7306e88
+
Jan Kratochvil 7306e88
+# Depending on the compiler being used, the type names can be printed differently.
Jan Kratochvil 7306e88
+set logical [fortran_logical4]
Jan Kratochvil 7306e88
+set real [fortran_real4]
Jan Kratochvil 7306e88
+set int [fortran_int4]
Jan Kratochvil 7306e88
+set complex [fortran_complex4]
Jan Kratochvil 7306e88
+
Jan Kratochvil 7306e88
+gdb_breakpoint [gdb_get_line_number "Before pointer assignment"]
Jan Kratochvil 7306e88
+gdb_continue_to_breakpoint "Before pointer assignment"
Jan Kratochvil 7306e88
+gdb_test "ptype logp" "type = PTR TO -> \\( $logical \\)" "ptype logp, not associated"
Jan Kratochvil 7306e88
+gdb_test "ptype comp" "type = PTR TO -> \\( $complex \\)" "ptype comp, not associated"
Jan Kratochvil 7306e88
+gdb_test "ptype charp" "type = PTR TO -> \\( character\\*1 \\)" "ptype charp, not associated"
Jan Kratochvil 7306e88
+gdb_test "ptype charap" "type = PTR TO -> \\( character\\*3 \\)" "ptype charap, not associated"
Jan Kratochvil 7306e88
+gdb_test "ptype intp" "type = PTR TO -> \\( $int \\)" "ptype intp, not associated"
Jan Kratochvil 7306e88
+set test "ptype intap, not associated"
Jan Kratochvil 7306e88
+gdb_test_multiple "ptype intap" $test {
Jan Kratochvil 7306e88
+    -re "type = PTR TO -> \\( $int \\(:,:\\)\\)\r\n$gdb_prompt $" {
Jan Kratochvil 7306e88
+        pass $test
Jan Kratochvil 7306e88
+    }
Jan Kratochvil 7306e88
+    -re "type = $int \\(:,:\\)\r\n$gdb_prompt $" {
Jan Kratochvil 7306e88
+        pass $test
Jan Kratochvil 7306e88
+    }
Jan Kratochvil 7306e88
+}
Jan Kratochvil 7306e88
+gdb_test "ptype realp" "type = PTR TO -> \\( $real \\)" "ptype realp, not associated"
Jan Kratochvil 7306e88
+gdb_test "ptype twop" \
Jan Kratochvil 7306e88
+    [multi_line "type = PTR TO -> \\( Type two" \
Jan Kratochvil 7306e88
+                "    $int :: ivla1\\(:\\)" \
Jan Kratochvil 7306e88
+                "    $int :: ivla2\\(:,:\\)" \
Jan Kratochvil 7306e88
+                "End Type two \\)"] \
Jan Kratochvil 7306e88
+    "ptype twop, not associated"
Jan Kratochvil 7306e88
+gdb_test "ptype two" \
Jan Kratochvil 7306e88
+    [multi_line "type = Type two" \
Jan Kratochvil 7306e88
+                "    $int :: ivla1\\(:\\)" \
Jan Kratochvil 7306e88
+                "    $int :: ivla2\\(:,:\\)" \
Jan Kratochvil 7306e88
+                "End Type two"]
Jan Kratochvil 7306e88
+
Jan Kratochvil 7306e88
+
Jan Kratochvil 7306e88
+gdb_breakpoint [gdb_get_line_number "Before value assignment"]
Jan Kratochvil 7306e88
+gdb_continue_to_breakpoint "Before value assignment"
Jan Kratochvil 7306e88
+gdb_test "ptype twop" \
Jan Kratochvil 7306e88
+    [multi_line "type = PTR TO -> \\( Type two" \
Jan Kratochvil 7306e88
+                "    $int :: ivla1\\(:\\)" \
Jan Kratochvil 7306e88
+                "    $int :: ivla2\\(:,:\\)" \
Jan Kratochvil 7306e88
+                "End Type two \\)"]
Jan Kratochvil 7306e88
+
Jan Kratochvil 7306e88
+
Jan Kratochvil 7306e88
+gdb_breakpoint [gdb_get_line_number "After value assignment"]
Jan Kratochvil 7306e88
+gdb_continue_to_breakpoint "After value assignment"
Jan Kratochvil 7306e88
+gdb_test "ptype logv" "type = $logical"
Jan Kratochvil 7306e88
+gdb_test "ptype comv" "type = $complex"
Jan Kratochvil 7306e88
+gdb_test "ptype charv" "type = character\\*1"
Jan Kratochvil 7306e88
+gdb_test "ptype chara" "type = character\\*3"
Jan Kratochvil 7306e88
+gdb_test "ptype intv" "type = $int"
Jan Kratochvil 7306e88
+gdb_test "ptype inta" "type = $int \\(10,2\\)"
Jan Kratochvil 7306e88
+gdb_test "ptype realv" "type = $real"
Jan Kratochvil 7306e88
+
Jan Kratochvil 7306e88
+
Jan Kratochvil 7306e88
+gdb_test "ptype logp" "type = PTR TO -> \\( $logical \\)"
Jan Kratochvil 7306e88
+gdb_test "ptype comp" "type = PTR TO -> \\( $complex \\)"
Jan Kratochvil 7306e88
+gdb_test "ptype charp" "type = PTR TO -> \\( character\\*1 \\)"
Jan Kratochvil 7306e88
+gdb_test "ptype charap" "type = PTR TO -> \\( character\\*3 \\)"
Jan Kratochvil 7306e88
+gdb_test "ptype intp" "type = PTR TO -> \\( $int \\)"
Jan Kratochvil 7306e88
+set test "ptype intap"
Jan Kratochvil 7306e88
+gdb_test_multiple $test $test {
Jan Kratochvil 7306e88
+    -re "type = $int \\(10,2\\)\r\n$gdb_prompt $" {
Jan Kratochvil 7306e88
+        pass $test
Jan Kratochvil 7306e88
+    }
Jan Kratochvil 7306e88
+    -re "type = PTR TO -> \\( $int \\(10,2\\)\\)\r\n$gdb_prompt $" {
Jan Kratochvil 7306e88
+        pass $test
Jan Kratochvil 7306e88
+    }
Jan Kratochvil 7306e88
+}
Jan Kratochvil 7306e88
+gdb_test "ptype realp" "type = PTR TO -> \\( $real \\)"
Jan Kratochvil 7306e88
Index: gdb-7.11.50.20160630/gdb/testsuite/gdb.fortran/vla-ptype.exp
Jan Kratochvil 7306e88
===================================================================
Jan Kratochvil 7306e88
--- gdb-7.11.50.20160630.orig/gdb/testsuite/gdb.fortran/vla-ptype.exp	2016-07-16 10:54:48.749099150 +0200
Jan Kratochvil 7306e88
+++ gdb-7.11.50.20160630/gdb/testsuite/gdb.fortran/vla-ptype.exp	2016-07-16 10:55:42.079525860 +0200
Jan Kratochvil 7306e88
@@ -32,9 +32,9 @@
Jan Kratochvil 7306e88
 # Check the ptype of various VLA states and pointer to VLA's.
Jan Kratochvil 7306e88
 gdb_breakpoint [gdb_get_line_number "vla1-init"]
Jan Kratochvil 7306e88
 gdb_continue_to_breakpoint "vla1-init"
Jan Kratochvil 7306e88
-gdb_test "ptype vla1" "type = <not allocated>" "ptype vla1 not initialized"
Jan Kratochvil 7306e88
-gdb_test "ptype vla2" "type = <not allocated>" "ptype vla2 not initialized"
Jan Kratochvil 7306e88
-gdb_test "ptype pvla" "type = <not associated>" "ptype pvla not initialized"
Jan Kratochvil 7306e88
+gdb_test "ptype vla1" "type = $real \\(:,:,:\\)" "ptype vla1 not initialized"
Jan Kratochvil 7306e88
+gdb_test "ptype vla2" "type = $real \\(:,:,:\\)" "ptype vla2 not initialized"
Jan Kratochvil 7306e88
+gdb_test "ptype pvla" "type = $real \\(:,:,:\\)" "ptype pvla not initialized"
Jan Kratochvil 7306e88
 gdb_test "ptype vla1(3, 6, 9)" "no such vector element \\\(vector not allocated\\\)" \
Jan Kratochvil 7306e88
   "ptype vla1(3, 6, 9) not initialized"
Jan Kratochvil 7306e88
 gdb_test "ptype vla2(5, 45, 20)" \
Jan Kratochvil 7306e88
@@ -81,20 +81,20 @@
Jan Kratochvil 7306e88
 
Jan Kratochvil 7306e88
 gdb_breakpoint [gdb_get_line_number "pvla-deassociated"]
Jan Kratochvil 7306e88
 gdb_continue_to_breakpoint "pvla-deassociated"
Jan Kratochvil 7306e88
-gdb_test "ptype pvla" "type = <not associated>" "ptype pvla deassociated"
Jan Kratochvil 7306e88
+gdb_test "ptype pvla" "type = $real \\(:,:,:\\)" "ptype pvla deassociated"
Jan Kratochvil 7306e88
 gdb_test "ptype pvla(5, 45, 20)" \
Jan Kratochvil 7306e88
   "no such vector element \\\(vector not associated\\\)" \
Jan Kratochvil 7306e88
   "ptype pvla(5, 45, 20) not associated"
Jan Kratochvil 7306e88
 
Jan Kratochvil 7306e88
 gdb_breakpoint [gdb_get_line_number "vla1-deallocated"]
Jan Kratochvil 7306e88
 gdb_continue_to_breakpoint "vla1-deallocated"
Jan Kratochvil 7306e88
-gdb_test "ptype vla1" "type = <not allocated>" "ptype vla1 not allocated"
Jan Kratochvil 7306e88
+gdb_test "ptype vla1" "type = $real \\(:,:,:\\)" "ptype vla1 not allocated"
Jan Kratochvil 7306e88
 gdb_test "ptype vla1(3, 6, 9)" "no such vector element \\\(vector not allocated\\\)" \
Jan Kratochvil 7306e88
   "ptype vla1(3, 6, 9) not allocated"
Jan Kratochvil 7306e88
 
Jan Kratochvil 7306e88
 gdb_breakpoint [gdb_get_line_number "vla2-deallocated"]
Jan Kratochvil 7306e88
 gdb_continue_to_breakpoint "vla2-deallocated"
Jan Kratochvil 7306e88
-gdb_test "ptype vla2" "type = <not allocated>" "ptype vla2 not allocated"
Jan Kratochvil 7306e88
+gdb_test "ptype vla2" "type = $real \\(:,:,:\\)" "ptype vla2 not allocated"
Jan Kratochvil 7306e88
 gdb_test "ptype vla2(5, 45, 20)" \
Jan Kratochvil 7306e88
   "no such vector element \\\(vector not allocated\\\)" \
Jan Kratochvil 7306e88
   "ptype vla2(5, 45, 20) not allocated"
Jan Kratochvil 7306e88
Index: gdb-7.11.50.20160630/gdb/testsuite/gdb.fortran/vla-type.exp
Jan Kratochvil 7306e88
===================================================================
Jan Kratochvil 7306e88
--- gdb-7.11.50.20160630.orig/gdb/testsuite/gdb.fortran/vla-type.exp	2016-07-16 10:54:48.749099150 +0200
Jan Kratochvil 7306e88
+++ gdb-7.11.50.20160630/gdb/testsuite/gdb.fortran/vla-type.exp	2016-07-16 10:55:42.080525868 +0200
Jan Kratochvil 7306e88
@@ -132,7 +132,10 @@
Jan Kratochvil 7306e88
                      "End Type one" ]
Jan Kratochvil 7306e88
 
Jan Kratochvil 7306e88
 # Check allocation status of dynamic array and it's dynamic members
Jan Kratochvil 7306e88
-gdb_test "ptype fivedynarr" "type = <not allocated>"
Jan Kratochvil 7306e88
+gdb_test "ptype fivedynarr" \
Jan Kratochvil 7306e88
+         [multi_line "type = Type five" \
Jan Kratochvil 7306e88
+                     "    Type one :: tone" \
Jan Kratochvil 7306e88
+                     "End Type five \\(:\\)" ]
Jan Kratochvil 7306e88
 gdb_test "next" ""
Jan Kratochvil 7306e88
 gdb_test "ptype fivedynarr(2)" \
Jan Kratochvil 7306e88
          [multi_line "type = Type five" \
Jan Kratochvil 7306e88
@@ -141,7 +144,7 @@
Jan Kratochvil 7306e88
          "ptype fivedynarr(2), tone is not allocated"
Jan Kratochvil 7306e88
 gdb_test "ptype fivedynarr(2)%tone" \
Jan Kratochvil 7306e88
          [multi_line "type = Type one" \
Jan Kratochvil 7306e88
-                     "    $int :: ivla\\(<not allocated>\\)" \
Jan Kratochvil 7306e88
+                     "    $int :: ivla\\(:,:,:\\)" \
Jan Kratochvil 7306e88
                      "End Type one" ] \
Jan Kratochvil 7306e88
          "ptype fivedynarr(2)%tone, not allocated"
Jan Kratochvil 7306e88
 
Jan Kratochvil 7306e88
Index: gdb-7.11.50.20160630/gdb/testsuite/gdb.fortran/vla-value.exp
Jan Kratochvil 7306e88
===================================================================
Jan Kratochvil 7306e88
--- gdb-7.11.50.20160630.orig/gdb/testsuite/gdb.fortran/vla-value.exp	2016-07-16 10:54:48.749099150 +0200
Jan Kratochvil 7306e88
+++ gdb-7.11.50.20160630/gdb/testsuite/gdb.fortran/vla-value.exp	2016-07-16 10:55:42.080525868 +0200
Jan Kratochvil 7306e88
@@ -34,7 +34,7 @@
Jan Kratochvil 7306e88
 gdb_continue_to_breakpoint "vla1-init"
Jan Kratochvil 7306e88
 gdb_test "print vla1" " = <not allocated>" "print non-allocated vla1"
Jan Kratochvil 7306e88
 gdb_test "print &vla1" \
Jan Kratochvil 7306e88
-  " = \\\(PTR TO -> \\\( $real \\\(<not allocated>\\\)\\\)\\\) $hex" \
Jan Kratochvil 7306e88
+  " = \\\(PTR TO -> \\\( $real \\\(:,:,:\\\)\\\)\\\) $hex" \
Jan Kratochvil 7306e88
   "print non-allocated &vla1"
Jan Kratochvil 7306e88
 gdb_test "print vla1(1,1,1)" "no such vector element \\\(vector not allocated\\\)" \
Jan Kratochvil 7306e88
   "print member in non-allocated vla1 (1)"
Jan Kratochvil 7306e88
@@ -75,7 +75,7 @@
Jan Kratochvil 7306e88
 # Try to access values in undefined pointer to VLA (dangling)
Jan Kratochvil 7306e88
 gdb_test "print pvla" " = <not associated>" "print undefined pvla"
Jan Kratochvil 7306e88
 gdb_test "print &pvla" \
Jan Kratochvil 7306e88
-  " = \\\(PTR TO -> \\\( $real \\\(<not associated>\\\)\\\)\\\) $hex" \
Jan Kratochvil 7306e88
+  " = \\\(PTR TO -> \\\( $real \\\(:,:,:\\\)\\\)\\\) $hex" \
Jan Kratochvil 7306e88
   "print non-associated &pvla"
Jan Kratochvil 7306e88
 gdb_test "print pvla(1, 3, 8)" "no such vector element \\\(vector not associated\\\)" \
Jan Kratochvil 7306e88
   "print undefined pvla(1,3,8)"
Jan Kratochvil 7306e88
Index: gdb-7.11.50.20160630/gdb/testsuite/gdb.mi/mi-vla-fortran.exp
Jan Kratochvil 7306e88
===================================================================
Jan Kratochvil 7306e88
--- gdb-7.11.50.20160630.orig/gdb/testsuite/gdb.mi/mi-vla-fortran.exp	2016-07-16 10:54:48.749099150 +0200
Jan Kratochvil 7306e88
+++ gdb-7.11.50.20160630/gdb/testsuite/gdb.mi/mi-vla-fortran.exp	2016-07-16 10:55:42.080525868 +0200
Jan Kratochvil 7306e88
@@ -17,6 +17,7 @@
Jan Kratochvil 7306e88
 # Array (VLA).
Jan Kratochvil 7306e88
 
Jan Kratochvil 7306e88
 load_lib mi-support.exp
Jan Kratochvil 7306e88
+load_lib fortran.exp
Jan Kratochvil 7306e88
 set MIFLAGS "-i=mi"
Jan Kratochvil 7306e88
 load_lib "fortran.exp"
Jan Kratochvil 7306e88
 
Jan Kratochvil 7306e88
@@ -50,10 +51,10 @@
Jan Kratochvil 7306e88
 mi_gdb_test "500-data-evaluate-expression vla1" \
Jan Kratochvil 7306e88
   "500\\^done,value=\"<not allocated>\"" "evaluate not allocated vla"
Jan Kratochvil 7306e88
 
Jan Kratochvil 7306e88
-mi_create_varobj_checked vla1_not_allocated vla1 "<not allocated>" \
Jan Kratochvil 7306e88
+mi_create_varobj_checked vla1_not_allocated vla1 "$real \\(:\\)" \
Jan Kratochvil 7306e88
   "create local variable vla1_not_allocated"
Jan Kratochvil 7306e88
 mi_gdb_test "501-var-info-type vla1_not_allocated" \
Jan Kratochvil 7306e88
-  "501\\^done,type=\"<not allocated>\"" \
Jan Kratochvil 7306e88
+  "501\\^done,type=\"$real \\(:\\)\"" \
Jan Kratochvil 7306e88
   "info type variable vla1_not_allocated"
Jan Kratochvil 7306e88
 mi_gdb_test "502-var-show-format vla1_not_allocated" \
Jan Kratochvil 7306e88
   "502\\^done,format=\"natural\"" \
Jan Kratochvil 7306e88
@@ -140,10 +141,10 @@
Jan Kratochvil 7306e88
     -re "580\\^done,value=\"<not associated>\".*${mi_gdb_prompt}$" {
Jan Kratochvil 7306e88
 	pass $test
Jan Kratochvil 7306e88
 
Jan Kratochvil 7306e88
-	mi_create_varobj_checked pvla2_not_associated pvla2 "<not associated>" \
Jan Kratochvil 7306e88
+	mi_create_varobj_checked pvla2_not_associated pvla2 "$real \\(:,:\\)" \
Jan Kratochvil 7306e88
 	    "create local variable pvla2_not_associated"
Jan Kratochvil 7306e88
 	mi_gdb_test "581-var-info-type pvla2_not_associated" \
Jan Kratochvil 7306e88
-	    "581\\^done,type=\"<not associated>\"" \
Jan Kratochvil 7306e88
+	    "581\\^done,type=\"$real \\(:,:\\)\"" \
Jan Kratochvil 7306e88
 	    "info type variable pvla2_not_associated"
Jan Kratochvil 7306e88
 	mi_gdb_test "582-var-show-format pvla2_not_associated" \
Jan Kratochvil 7306e88
 	    "582\\^done,format=\"natural\"" \