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

2c2fa1
http://sourceware.org/ml/gdb-patches/2012-08/msg00562.html
2c2fa1
Subject: [PATCH] Expand fortran array bounds sizes to LONGEST
2c2fa1
2c2fa1
2c2fa1
--MP_/90J7bck2fqDySEX9JkZtaqL
2c2fa1
Content-Type: text/plain; charset=US-ASCII
2c2fa1
Content-Transfer-Encoding: 7bit
2c2fa1
Content-Disposition: inline
2c2fa1
2c2fa1
Hi,
2c2fa1
2c2fa1
Range bounds for a gdb type can have LONGEST values for low and high
2c2fa1
bounds. Fortran range bounds functions however use only int. The larger
2c2fa1
ranges don't compile by default on gcc, but it is possible to override
2c2fa1
the check in the compiler by using -fno-range-check. As a result, this
2c2fa1
check is necessary so that we don't print junk in case of an overflow.
2c2fa1
2c2fa1
Attached patch does this expansion and also includes a test case that
2c2fa1
verifies that the problem is fixed. I have also verified on x86_64 that
2c2fa1
this patch does not cause any regressions.
2c2fa1
2c2fa1
Regards,
2c2fa1
Siddhesh
2c2fa1
2c2fa1
gdb/ChangeLog:
2c2fa1
2c2fa1
	* f-lang.h (f77_get_upperbound): Return LONGEST.
2c2fa1
	(f77_get_lowerbound): Likewise.
2c2fa1
	* f-typeprint.c (f_type_print_varspec_suffix): Expand
2c2fa1
	UPPER_BOUND and LOWER_BOUND to LONGEST.  Use plongest to format
2c2fa1
	print them.
2c2fa1
	(f_type_print_base): Expand UPPER_BOUND to LONGEST.  Use
2c2fa1
	plongest to format print it.
2c2fa1
	* f-valprint.c (f77_get_lowerbound): Return LONGEST.
2c2fa1
	(f77_get_upperbound): Likewise.
2c2fa1
	(f77_get_dynamic_length_of_aggregate): Expand UPPER_BOUND,
2c2fa1
	LOWER_BOUND to LONGEST.
2c2fa1
	(f77_create_arrayprint_offset_tbl): Likewise.
2c2fa1
2c2fa1
testsuite/ChangeLog:
2c2fa1
2c2fa1
	* gdb.fortran/array-bounds.exp: New test case.
2c2fa1
	* gdb.fortran/array-bounds.f: New test case.
2c2fa1
2c2fa1
--MP_/90J7bck2fqDySEX9JkZtaqL
2c2fa1
Content-Type: text/x-patch
2c2fa1
Content-Transfer-Encoding: 7bit
2c2fa1
Content-Disposition: attachment; filename=f77-bounds.patch
2c2fa1
2c2fa1
Index: gdb-7.5.50.20130118/gdb/f-lang.h
2c2fa1
===================================================================
2c2fa1
--- gdb-7.5.50.20130118.orig/gdb/f-lang.h	2013-01-18 23:39:40.209500968 +0100
2c2fa1
+++ gdb-7.5.50.20130118/gdb/f-lang.h	2013-01-18 23:40:04.010531177 +0100
2c2fa1
@@ -65,9 +65,9 @@ struct common_block
2c2fa1
   struct symbol *contents[1];
2c2fa1
 };
2c2fa1
 
2c2fa1
-extern int f77_get_upperbound (struct type *);
2c2fa1
+extern LONGEST f77_get_upperbound (struct type *);
2c2fa1
 
2c2fa1
-extern int f77_get_lowerbound (struct type *);
2c2fa1
+extern LONGEST f77_get_lowerbound (struct type *);
2c2fa1
 
2c2fa1
 extern void f77_get_dynamic_array_length (struct type *);
2c2fa1
 
2c2fa1
Index: gdb-7.5.50.20130118/gdb/f-typeprint.c
2c2fa1
===================================================================
2c2fa1
--- gdb-7.5.50.20130118.orig/gdb/f-typeprint.c	2013-01-18 23:39:37.564497620 +0100
2c2fa1
+++ gdb-7.5.50.20130118/gdb/f-typeprint.c	2013-01-18 23:39:40.210500970 +0100
2c2fa1
@@ -180,7 +180,7 @@ f_type_print_varspec_suffix (struct type
2c2fa1
 			     int show, int passed_a_ptr, int demangled_args,
2c2fa1
 			     int arrayprint_recurse_level)
2c2fa1
 {
2c2fa1
-  int upper_bound, lower_bound;
2c2fa1
+  LONGEST upper_bound, lower_bound;
2c2fa1
 
2c2fa1
   /* No static variables are permitted as an error call may occur during
2c2fa1
      execution of this function.  */
2c2fa1
@@ -210,7 +210,7 @@ f_type_print_varspec_suffix (struct type
2c2fa1
 
2c2fa1
       lower_bound = f77_get_lowerbound (type);
2c2fa1
       if (lower_bound != 1)	/* Not the default.  */
2c2fa1
-	fprintf_filtered (stream, "%d:", lower_bound);
2c2fa1
+	fprintf_filtered (stream, "%s:", plongest (lower_bound));
2c2fa1
 
2c2fa1
       /* Make sure that, if we have an assumed size array, we
2c2fa1
          print out a warning and print the upperbound as '*'.  */
2c2fa1
@@ -220,7 +220,7 @@ f_type_print_varspec_suffix (struct type
2c2fa1
       else
2c2fa1
 	{
2c2fa1
 	  upper_bound = f77_get_upperbound (type);
2c2fa1
-	  fprintf_filtered (stream, "%d", upper_bound);
2c2fa1
+	  fprintf_filtered (stream, "%s", plongest (upper_bound));
2c2fa1
 	}
2c2fa1
 
2c2fa1
       if (TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_ARRAY)
2c2fa1
@@ -288,7 +288,7 @@ void
2c2fa1
 f_type_print_base (struct type *type, struct ui_file *stream, int show,
2c2fa1
 		   int level)
2c2fa1
 {
2c2fa1
-  int upper_bound;
2c2fa1
+  LONGEST upper_bound;
2c2fa1
   int index;
2c2fa1
 
2c2fa1
   QUIT;
2c2fa1
@@ -370,7 +370,7 @@ f_type_print_base (struct type *type, st
2c2fa1
       else
2c2fa1
 	{
2c2fa1
 	  upper_bound = f77_get_upperbound (type);
2c2fa1
-	  fprintf_filtered (stream, "character*%d", upper_bound);
2c2fa1
+	  fprintf_filtered (stream, "character*%s", plongest (upper_bound));
2c2fa1
 	}
2c2fa1
       break;
2c2fa1
 
2c2fa1
Index: gdb-7.5.50.20130118/gdb/f-valprint.c
2c2fa1
===================================================================
2c2fa1
--- gdb-7.5.50.20130118.orig/gdb/f-valprint.c	2013-01-18 23:39:37.564497620 +0100
2c2fa1
+++ gdb-7.5.50.20130118/gdb/f-valprint.c	2013-01-18 23:39:40.210500970 +0100
2c2fa1
@@ -57,7 +57,7 @@ LONGEST f77_array_offset_tbl[MAX_FORTRAN
2c2fa1
 
2c2fa1
 #define F77_DIM_BYTE_STRIDE(n) (f77_array_offset_tbl[n][0])
2c2fa1
 
2c2fa1
-int
2c2fa1
+LONGEST
2c2fa1
 f77_get_lowerbound (struct type *type)
2c2fa1
 {
2c2fa1
   f_object_address_data_valid_or_error (type);
2c2fa1
@@ -68,7 +68,7 @@ f77_get_lowerbound (struct type *type)
2c2fa1
   return TYPE_ARRAY_LOWER_BOUND_VALUE (type);
2c2fa1
 }
2c2fa1
 
2c2fa1
-int
2c2fa1
+LONGEST
2c2fa1
 f77_get_upperbound (struct type *type)
2c2fa1
 {
2c2fa1
   f_object_address_data_valid_or_error (type);
2c2fa1
@@ -92,8 +92,8 @@ f77_get_upperbound (struct type *type)
2c2fa1
 static void
2c2fa1
 f77_get_dynamic_length_of_aggregate (struct type *type)
2c2fa1
 {
2c2fa1
-  int upper_bound = -1;
2c2fa1
-  int lower_bound = 1;
2c2fa1
+  LONGEST upper_bound = -1;
2c2fa1
+  LONGEST lower_bound = 1;
2c2fa1
 
2c2fa1
   /* Recursively go all the way down into a possibly multi-dimensional
2c2fa1
      F77 array and get the bounds.  For simple arrays, this is pretty
2c2fa1
@@ -128,7 +128,7 @@ f77_create_arrayprint_offset_tbl (struct
2c2fa1
   struct type *tmp_type;
2c2fa1
   LONGEST eltlen;
2c2fa1
   int ndimen = 1;
2c2fa1
-  int upper, lower;
2c2fa1
+  LONGEST upper, lower;
2c2fa1
 
2c2fa1
   tmp_type = type;
2c2fa1