This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Hi all, Problem description: Due to a bug GDB is not able to print arrays with very high indexes (lower/upper bounds). As explained below. A) gdb crashes while printing arrays with very high positive index program main integer(4) :: arr(4294967296_8:4294967297_8) integer(8) :: lb, ub arr = 99 lb = lbound (arr, dim = 1, kind = 8) ub = ubound (arr, dim = 1, kind = 8) print *, 'bounds of arr - ', lb, ':', ub end Actual output: it crashes while printing array GNU gdb (GDB) 10.0.50.20200127-git (gdb) p arr Aborted (core dumped) Expected output (gdb) p arr $1 = (99, 99) B) gdb is not able to print arrays with very high negative indexes program main integer(4) :: arr(-4294967297_8:-4294967296_8) integer(8) :: lb, ub arr = 99 lb = lbound (arr, dim = 1, kind = 8) ub = ubound (arr, dim = 1, kind = 8) print *, 'bounds of arr - ', lb, ':', ub end Actual output: it displays empty array. (gdb) p arr $1 = () Expected output (gdb) p arr $1 = (99, 99) Root cause: 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. Resolution: We have now changed the datatype of 'i' to LONGEST which is same as datatype of bounds. Testing: - New test-case (gdb.fortran/array-bounds-high.exp) is added to test (+/-) high indexed array printing - There was no regression seen Please let me know your comments. Regards, Alok
Attachment:
0001-Fixed-gdb-to-print-arrays-with-very-high-indexes.patch
Description: 0001-Fixed-gdb-to-print-arrays-with-very-high-indexes.patch
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |