Discussion:
[Bug fortran/23182] New: gdb prints wrong contents of non-contiguous arrays
richard.foltyn at gmail dot com
2018-05-15 08:37:39 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=23182

Bug ID: 23182
Summary: gdb prints wrong contents of non-contiguous arrays
Product: gdb
Version: 8.1
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: fortran
Assignee: unassigned at sourceware dot org
Reporter: richard.foltyn at gmail dot com
Target Milestone: ---

Created attachment 11017
--> https://sourceware.org/bugzilla/attachment.cgi?id=11017&action=edit
code to replicate the example given

Hi,

gdb incorrectly prints the contents of array dummy arguments if the actual
argument is a non-contiguous array section.

For example, using the demo in main.f90, when inspecting the array X in
subroutine SUB1 in gdb, it prints
(gdb) p x
$1 = (( 1, 2) ( 3, 4) ( 5, 6) )

while the array contents printed using PRINT in that routine displays the
correct values
1, 2, 4, 5, 7, 8
--
You are receiving this mail because:
You are on the CC list for the bug.
kuba at witomi dot pl
2018-09-07 12:08:58 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=23182

wytrzeszcz <kuba at witomi dot pl> changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |kuba at witomi dot pl
--
You are receiving this mail because:
You are on the CC list for the bug.
kuba at witomi dot pl
2018-09-07 06:43:43 UTC
Permalink
https://sourceware.org/bugzilla/show_bug.cgi?id=23182

--- Comment #1 from wytrzeszcz <kuba at witomi dot pl> ---
Hi,
I'm looking for possible reason and I found that print array itself can work
properly but somehow 'x' and 'arr' has similar address.

I run example code form attachment, add second similar print and pause in
between of them



(gdb) p *(&x)@2
$23 = (( ( 1, 2) ( 3, 4) ( 5, 6) ) ( ( 7, 8) ( 9, 0) ( 1286409216, 549739804) )
)
(gdb) p *(&arr)@2
$24 = (( ( 1, 2, 3) ( 4, 5, 6) ( 7, 8, 9) ) ( ( 0, 1286409216, 549739804) (
-8128, 32767, 1431655342) ( 21845, -7896, 32767) ) )
(gdb) p &arr
$25 = (PTR TO -> ( integer(kind=4) (3,3))) 0x7fffffffdff0
(gdb) p &x
$26 = (PTR TO -> ( integer(kind=4) (2,3))) 0x7fffffffdff0
--
You are receiving this mail because:
You are on the CC list for the bug.
Loading...