gdb crashes on printing allocatable array in Fortran derived type
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
gdb (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
Package: gdb (8.1-0ubuntu3.2 Ubuntu:
Ubuntu Release: Ubuntu 18.04.4 LTS
Bug occurs when trying to print allocatable or pointer component of a Fortran derived-type structure in gdb.
Expected behavior:
gdb prints the contents of array BUFFER%ALPHA in the MWE below.
Observed behavior:
See upstream report https:/
When trying to print BUFFER%ALPHA, gdb crashes. The MWE copied form the above link is:
1 PROGRAM allocate_array
2
3 TYPE L_BUFFER
4 REAL, DIMENSION(:), POINTER :: ALPHA
5 END TYPE L_BUFFER
6 TYPE(L_BUFFER), POINTER :: BUFFER
7
8 ALLOCATE(BUFFER)
9
10 ALLOCATE(
11
12 BUFFER%
13 print *, buffer%alpha
14
15 END PROGRAM allocate_array
And the gdb output reads:
Breakpoint 1, allocate_array () at allocate_
13 print *, buffer%alpha
(gdb) i lo
buffer = 0x603f80
(gdb) p *buffer
$1 = (
value.c:3116: internal-error: value* value_primitive
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) n
The same error can be observed from inside a type-bound procedure when trying to print THIS%ALPHA (where this is the instance variable).
The assertion fails since TYPE_DATA_
This bug renders debugging of Fortran code with visual tools (vscode, eclipse, etc.) very difficult as the components are parsed automatically, leading to a crash.