diff options
author | Alok Kumar Sharma <AlokKumar.Sharma@amd.com> | 2020-02-03 20:24:34 -0500 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2020-02-03 20:24:34 -0500 |
commit | e409c542cc3cedebf78c7827e976d36955d477bb (patch) | |
tree | a8231b01637b95ed9efb80cb7155e8241f4c86c1 /gdb/f-valprint.c | |
parent | 6ec6b3c8abd0378ad6e750570c038b05b6e87703 (diff) | |
download | gdb-e409c542cc3cedebf78c7827e976d36955d477bb.zip gdb-e409c542cc3cedebf78c7827e976d36955d477bb.tar.gz gdb-e409c542cc3cedebf78c7827e976d36955d477bb.tar.bz2 |
Fixed gdb to print arrays with very high indexes
In the function f77_print_array_1, the variable 'i' which holds the
index is of datatype 'int', while bounds are of datatype LONGEST. Due to
size of int being smaller than LONGEST, the variable 'i' stores
incorrect values for high indexes (higher than max limit of int). Due
to this issue in sources, two abnormal behaviors are seen while printing
arrays with high indexes (please check array-bounds-high.f90) For high
indexes with negative sign, gdb prints empty array even if the array has
elements.
(gdb) p arr
$1 = ()
For high indexes with positive sign, gdb crashes. We have now changed
the datatype of 'i' to LONGEST which is same as datatype of bounds.
gdb/ChangeLog:
* f-valprint.c (f77_print_array_1): Changed datatype of index
variable to LONGEST from int to enable it to contain bound
values correctly.
gdb/testsuite/ChangeLog:
* gdb.fortran/array-bounds-high.exp: New file.
* gdb.fortran/array-bounds-high.f90: New file.
Change-Id: Ie2dce9380a249e634e2684b9c90f225e104369b7
Diffstat (limited to 'gdb/f-valprint.c')
-rw-r--r-- | gdb/f-valprint.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c index 168957f..71247a7 100644 --- a/gdb/f-valprint.c +++ b/gdb/f-valprint.c @@ -115,7 +115,7 @@ f77_print_array_1 (int nss, int ndimensions, struct type *type, struct type *range_type = TYPE_INDEX_TYPE (check_typedef (type)); CORE_ADDR addr = address + embedded_offset; LONGEST lowerbound, upperbound; - int i; + LONGEST i; get_discrete_bounds (range_type, &lowerbound, &upperbound); |