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

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