Blame SOURCES/gdb-rhbz795424-bitpos-25of25.patch

e1d87d
http://sourceware.org/ml/gdb-patches/2012-08/msg00562.html
e1d87d
Subject: [PATCH] Expand fortran array bounds sizes to LONGEST
e1d87d
e1d87d
e1d87d
--MP_/90J7bck2fqDySEX9JkZtaqL
e1d87d
Content-Type: text/plain; charset=US-ASCII
e1d87d
Content-Transfer-Encoding: 7bit
e1d87d
Content-Disposition: inline
e1d87d
e1d87d
Hi,
e1d87d
e1d87d
Range bounds for a gdb type can have LONGEST values for low and high
e1d87d
bounds. Fortran range bounds functions however use only int. The larger
e1d87d
ranges don't compile by default on gcc, but it is possible to override
e1d87d
the check in the compiler by using -fno-range-check. As a result, this
e1d87d
check is necessary so that we don't print junk in case of an overflow.
e1d87d
e1d87d
Attached patch does this expansion and also includes a test case that
e1d87d
verifies that the problem is fixed. I have also verified on x86_64 that
e1d87d
this patch does not cause any regressions.
e1d87d
e1d87d
Regards,
e1d87d
Siddhesh
e1d87d
e1d87d
gdb/ChangeLog:
e1d87d
e1d87d
	* f-lang.h (f77_get_upperbound): Return LONGEST.
e1d87d
	(f77_get_lowerbound): Likewise.
e1d87d
	* f-typeprint.c (f_type_print_varspec_suffix): Expand
e1d87d
	UPPER_BOUND and LOWER_BOUND to LONGEST.  Use plongest to format
e1d87d
	print them.
e1d87d
	(f_type_print_base): Expand UPPER_BOUND to LONGEST.  Use
e1d87d
	plongest to format print it.
e1d87d
	* f-valprint.c (f77_get_lowerbound): Return LONGEST.
e1d87d
	(f77_get_upperbound): Likewise.
e1d87d
	(f77_get_dynamic_length_of_aggregate): Expand UPPER_BOUND,
e1d87d
	LOWER_BOUND to LONGEST.
e1d87d
	(f77_create_arrayprint_offset_tbl): Likewise.
e1d87d
e1d87d
testsuite/ChangeLog:
e1d87d
e1d87d
	* gdb.fortran/array-bounds.exp: New test case.
e1d87d
	* gdb.fortran/array-bounds.f: New test case.
e1d87d
e1d87d
--MP_/90J7bck2fqDySEX9JkZtaqL
e1d87d
Content-Type: text/x-patch
e1d87d
Content-Transfer-Encoding: 7bit
e1d87d
Content-Disposition: attachment; filename=f77-bounds.patch
e1d87d
e1d87d
Index: gdb-7.11.90.20160907/gdb/f-lang.h
e1d87d
===================================================================
e1d87d
--- gdb-7.11.90.20160907.orig/gdb/f-lang.h	2016-09-07 21:48:33.308624019 +0200
e1d87d
+++ gdb-7.11.90.20160907/gdb/f-lang.h	2016-09-07 21:48:40.967692469 +0200
e1d87d
@@ -49,9 +49,9 @@
e1d87d
   struct symbol *contents[1];
e1d87d
 };
e1d87d
 
e1d87d
-extern int f77_get_upperbound (struct type *);
e1d87d
+extern LONGEST f77_get_upperbound (struct type *);
e1d87d
 
e1d87d
-extern int f77_get_lowerbound (struct type *);
e1d87d
+extern LONGEST f77_get_lowerbound (struct type *);
e1d87d
 
e1d87d
 extern void f77_get_dynamic_array_length (struct type *);
e1d87d
 
e1d87d
Index: gdb-7.11.90.20160907/gdb/f-typeprint.c
e1d87d
===================================================================
e1d87d
--- gdb-7.11.90.20160907.orig/gdb/f-typeprint.c	2016-09-07 21:48:33.309624028 +0200
e1d87d
+++ gdb-7.11.90.20160907/gdb/f-typeprint.c	2016-09-07 21:48:40.967692469 +0200
e1d87d
@@ -147,7 +147,7 @@
e1d87d
 			     int show, int passed_a_ptr, int demangled_args,
e1d87d
 			     int arrayprint_recurse_level, int print_rank_only)
e1d87d
 {
e1d87d
-  int upper_bound, lower_bound;
e1d87d
+  LONGEST upper_bound, lower_bound;
e1d87d
 
e1d87d
   /* No static variables are permitted as an error call may occur during
e1d87d
      execution of this function.  */
e1d87d
@@ -194,7 +194,7 @@
e1d87d
 	{
e1d87d
 	  lower_bound = f77_get_lowerbound (type);
e1d87d
 	  if (lower_bound != 1)	/* Not the default.  */
e1d87d
-	    fprintf_filtered (stream, "%d:", lower_bound);
e1d87d
+	    fprintf_filtered (stream, "%s:", plongest (lower_bound));
e1d87d
 
e1d87d
 	  /* Make sure that, if we have an assumed size array, we
e1d87d
 	       print out a warning and print the upperbound as '*'.  */
e1d87d
@@ -204,7 +204,7 @@
e1d87d
 	  else
e1d87d
 	    {
e1d87d
 	      upper_bound = f77_get_upperbound (type);
e1d87d
-	      fprintf_filtered (stream, "%d", upper_bound);
e1d87d
+	      fprintf_filtered (stream, "%s", plongest (upper_bound));
e1d87d
 	    }
e1d87d
 	}
e1d87d
 
e1d87d
@@ -276,7 +276,7 @@
e1d87d
 f_type_print_base (struct type *type, struct ui_file *stream, int show,
e1d87d
 		   int level)
e1d87d
 {
e1d87d
-  int upper_bound;
e1d87d
+  LONGEST upper_bound;
e1d87d
   int index;
e1d87d
 
e1d87d
   QUIT;
e1d87d
@@ -358,7 +358,7 @@
e1d87d
       else
e1d87d
 	{
e1d87d
 	  upper_bound = f77_get_upperbound (type);
e1d87d
-	  fprintf_filtered (stream, "character*%d", upper_bound);
e1d87d
+	  fprintf_filtered (stream, "character*%s", plongest (upper_bound));
e1d87d
 	}
e1d87d
       break;
e1d87d
 
e1d87d
Index: gdb-7.11.90.20160907/gdb/f-valprint.c
e1d87d
===================================================================
e1d87d
--- gdb-7.11.90.20160907.orig/gdb/f-valprint.c	2016-09-07 21:48:33.309624028 +0200
e1d87d
+++ gdb-7.11.90.20160907/gdb/f-valprint.c	2016-09-07 21:48:40.967692469 +0200
e1d87d
@@ -43,7 +43,7 @@
e1d87d
 /* Array which holds offsets to be applied to get a row's elements
e1d87d
    for a given array.  Array also holds the size of each subarray.  */
e1d87d
 
e1d87d
-int
e1d87d
+LONGEST
e1d87d
 f77_get_lowerbound (struct type *type)
e1d87d
 {
e1d87d
   if (TYPE_ARRAY_LOWER_BOUND_IS_UNDEFINED (type))
e1d87d
@@ -52,7 +52,7 @@
e1d87d
   return TYPE_ARRAY_LOWER_BOUND_VALUE (type);
e1d87d
 }
e1d87d
 
e1d87d
-int
e1d87d
+LONGEST
e1d87d
 f77_get_upperbound (struct type *type)
e1d87d
 {
e1d87d
   if (TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type))