2017-12-10 22:00:49 +00:00
|
|
|
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
2017-12-04 19:24:00 +00:00
|
|
|
From: Fedora GDB patches <invalid@email.com>
|
|
|
|
Date: Fri, 27 Oct 2017 21:07:50 +0200
|
2017-12-08 04:31:26 +00:00
|
|
|
Subject: Expand fortran array bounds sizes to LONGEST
|
2012-11-09 18:03:10 +00:00
|
|
|
|
2017-12-04 19:24:00 +00:00
|
|
|
FileName: gdb-rhbz795424-bitpos-25of25.patch
|
|
|
|
|
2017-12-08 04:31:26 +00:00
|
|
|
;; Fix `GDB cannot access struct member whose offset is larger than 256MB'
|
|
|
|
;; (RH BZ 795424).
|
|
|
|
;;=push
|
2017-12-04 19:24:00 +00:00
|
|
|
|
2017-12-08 04:31:26 +00:00
|
|
|
http://sourceware.org/ml/gdb-patches/2012-08/msg00562.html
|
2012-11-09 18:03:10 +00:00
|
|
|
|
|
|
|
--MP_/90J7bck2fqDySEX9JkZtaqL
|
|
|
|
Content-Type: text/plain; charset=US-ASCII
|
|
|
|
Content-Transfer-Encoding: 7bit
|
|
|
|
Content-Disposition: inline
|
|
|
|
|
|
|
|
Hi,
|
|
|
|
|
|
|
|
Range bounds for a gdb type can have LONGEST values for low and high
|
|
|
|
bounds. Fortran range bounds functions however use only int. The larger
|
|
|
|
ranges don't compile by default on gcc, but it is possible to override
|
|
|
|
the check in the compiler by using -fno-range-check. As a result, this
|
|
|
|
check is necessary so that we don't print junk in case of an overflow.
|
|
|
|
|
|
|
|
Attached patch does this expansion and also includes a test case that
|
|
|
|
verifies that the problem is fixed. I have also verified on x86_64 that
|
|
|
|
this patch does not cause any regressions.
|
|
|
|
|
|
|
|
Regards,
|
|
|
|
Siddhesh
|
|
|
|
|
|
|
|
gdb/ChangeLog:
|
|
|
|
|
|
|
|
* f-lang.h (f77_get_upperbound): Return LONGEST.
|
|
|
|
(f77_get_lowerbound): Likewise.
|
|
|
|
* f-typeprint.c (f_type_print_varspec_suffix): Expand
|
|
|
|
UPPER_BOUND and LOWER_BOUND to LONGEST. Use plongest to format
|
|
|
|
print them.
|
|
|
|
(f_type_print_base): Expand UPPER_BOUND to LONGEST. Use
|
|
|
|
plongest to format print it.
|
|
|
|
* f-valprint.c (f77_get_lowerbound): Return LONGEST.
|
|
|
|
(f77_get_upperbound): Likewise.
|
|
|
|
(f77_get_dynamic_length_of_aggregate): Expand UPPER_BOUND,
|
|
|
|
LOWER_BOUND to LONGEST.
|
|
|
|
(f77_create_arrayprint_offset_tbl): Likewise.
|
|
|
|
|
|
|
|
testsuite/ChangeLog:
|
|
|
|
|
|
|
|
* gdb.fortran/array-bounds.exp: New test case.
|
|
|
|
* gdb.fortran/array-bounds.f: New test case.
|
|
|
|
|
|
|
|
--MP_/90J7bck2fqDySEX9JkZtaqL
|
|
|
|
Content-Type: text/x-patch
|
|
|
|
Content-Transfer-Encoding: 7bit
|
|
|
|
Content-Disposition: attachment; filename=f77-bounds.patch
|
|
|
|
|
2017-12-08 04:31:26 +00:00
|
|
|
diff --git a/gdb/f-lang.h b/gdb/f-lang.h
|
2018-01-10 19:21:10 +00:00
|
|
|
index 9171a13bdf..9ec58f808e 100644
|
2017-12-08 04:31:26 +00:00
|
|
|
--- a/gdb/f-lang.h
|
|
|
|
+++ b/gdb/f-lang.h
|
|
|
|
@@ -49,9 +49,9 @@ struct common_block
|
2013-01-19 22:41:55 +00:00
|
|
|
struct symbol *contents[1];
|
|
|
|
};
|
2012-11-09 18:03:10 +00:00
|
|
|
|
|
|
|
-extern int f77_get_upperbound (struct type *);
|
|
|
|
+extern LONGEST f77_get_upperbound (struct type *);
|
|
|
|
|
|
|
|
-extern int f77_get_lowerbound (struct type *);
|
|
|
|
+extern LONGEST f77_get_lowerbound (struct type *);
|
|
|
|
|
|
|
|
extern void f77_get_dynamic_array_length (struct type *);
|
|
|
|
|
2017-12-08 04:31:26 +00:00
|
|
|
diff --git a/gdb/f-typeprint.c b/gdb/f-typeprint.c
|
2018-01-10 19:21:10 +00:00
|
|
|
index 4f6a0ed09a..c330522913 100644
|
2017-12-08 04:31:26 +00:00
|
|
|
--- a/gdb/f-typeprint.c
|
|
|
|
+++ b/gdb/f-typeprint.c
|
|
|
|
@@ -149,7 +149,7 @@ f_type_print_varspec_suffix (struct type *type, struct ui_file *stream,
|
2012-11-09 18:03:10 +00:00
|
|
|
int show, int passed_a_ptr, int demangled_args,
|
2016-07-17 14:35:49 +00:00
|
|
|
int arrayprint_recurse_level, int print_rank_only)
|
2012-11-09 18:03:10 +00:00
|
|
|
{
|
|
|
|
- int upper_bound, lower_bound;
|
|
|
|
+ LONGEST upper_bound, lower_bound;
|
|
|
|
|
|
|
|
/* No static variables are permitted as an error call may occur during
|
|
|
|
execution of this function. */
|
2017-12-08 04:31:26 +00:00
|
|
|
@@ -196,7 +196,7 @@ f_type_print_varspec_suffix (struct type *type, struct ui_file *stream,
|
2016-07-17 14:35:49 +00:00
|
|
|
{
|
|
|
|
lower_bound = f77_get_lowerbound (type);
|
|
|
|
if (lower_bound != 1) /* Not the default. */
|
|
|
|
- fprintf_filtered (stream, "%d:", lower_bound);
|
|
|
|
+ fprintf_filtered (stream, "%s:", plongest (lower_bound));
|
2014-06-19 20:14:32 +00:00
|
|
|
|
2016-07-17 14:35:49 +00:00
|
|
|
/* Make sure that, if we have an assumed size array, we
|
2016-09-07 20:47:48 +00:00
|
|
|
print out a warning and print the upperbound as '*'. */
|
2017-12-08 04:31:26 +00:00
|
|
|
@@ -206,7 +206,7 @@ f_type_print_varspec_suffix (struct type *type, struct ui_file *stream,
|
2016-07-17 14:35:49 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
upper_bound = f77_get_upperbound (type);
|
|
|
|
- fprintf_filtered (stream, "%d", upper_bound);
|
|
|
|
+ fprintf_filtered (stream, "%s", plongest (upper_bound));
|
|
|
|
}
|
|
|
|
}
|
2014-06-19 20:14:32 +00:00
|
|
|
|
2017-12-08 04:31:26 +00:00
|
|
|
@@ -278,7 +278,7 @@ void
|
2012-11-09 18:03:10 +00:00
|
|
|
f_type_print_base (struct type *type, struct ui_file *stream, int show,
|
|
|
|
int level)
|
|
|
|
{
|
|
|
|
- int upper_bound;
|
|
|
|
+ LONGEST upper_bound;
|
|
|
|
int index;
|
|
|
|
|
|
|
|
QUIT;
|
2017-12-08 04:31:26 +00:00
|
|
|
@@ -365,7 +365,7 @@ f_type_print_base (struct type *type, struct ui_file *stream, int show,
|
2012-11-09 18:03:10 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
upper_bound = f77_get_upperbound (type);
|
|
|
|
- fprintf_filtered (stream, "character*%d", upper_bound);
|
|
|
|
+ fprintf_filtered (stream, "character*%s", plongest (upper_bound));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2017-12-08 04:31:26 +00:00
|
|
|
diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c
|
2018-01-10 19:21:10 +00:00
|
|
|
index 0772f359f0..03400ae431 100644
|
2017-12-08 04:31:26 +00:00
|
|
|
--- a/gdb/f-valprint.c
|
|
|
|
+++ b/gdb/f-valprint.c
|
|
|
|
@@ -41,7 +41,7 @@ LONGEST f77_array_offset_tbl[MAX_FORTRAN_DIMS + 1][2];
|
2014-06-19 20:14:32 +00:00
|
|
|
/* Array which holds offsets to be applied to get a row's elements
|
|
|
|
for a given array. Array also holds the size of each subarray. */
|
2012-11-09 18:03:10 +00:00
|
|
|
|
|
|
|
-int
|
|
|
|
+LONGEST
|
|
|
|
f77_get_lowerbound (struct type *type)
|
|
|
|
{
|
2014-06-19 20:14:32 +00:00
|
|
|
if (TYPE_ARRAY_LOWER_BOUND_IS_UNDEFINED (type))
|
2017-12-08 04:31:26 +00:00
|
|
|
@@ -50,7 +50,7 @@ f77_get_lowerbound (struct type *type)
|
2012-11-09 18:03:10 +00:00
|
|
|
return TYPE_ARRAY_LOWER_BOUND_VALUE (type);
|
|
|
|
}
|
|
|
|
|
|
|
|
-int
|
|
|
|
+LONGEST
|
|
|
|
f77_get_upperbound (struct type *type)
|
|
|
|
{
|
2014-06-19 20:14:32 +00:00
|
|
|
if (TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type))
|