public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/29842] New: Debugging variables with ALLOCATABLE attribute fails to read variable properties correctly
@ 2022-12-02 18:45 emr-gnu at hev dot psu.edu
2022-12-05 19:01 ` [Bug fortran/29842] " emr-gnu at hev dot psu.edu
0 siblings, 1 reply; 2+ messages in thread
From: emr-gnu at hev dot psu.edu @ 2022-12-02 18:45 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=29842
Bug ID: 29842
Summary: Debugging variables with ALLOCATABLE attribute fails
to read variable properties correctly
Product: gdb
Version: HEAD
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: fortran
Assignee: unassigned at sourceware dot org
Reporter: emr-gnu at hev dot psu.edu
Target Milestone: ---
Created attachment 14476
--> https://sourceware.org/bugzilla/attachment.cgi?id=14476&action=edit
Reproducer
In the attached program, gdb version ac57bf55 (current HEAD as of this
writing), GDB fails to debug the contents (or even the size/address) of Fortran
variables marked with the ALLOCATABLE attribute when built with the Intel ifort
compiler. I have not checked LLVM (gfortran-12.1 works fine).
----------------
gfortran-12.1 -ffixed-line-length-none -g -O0 -o main main.for
ifort -g -O0 -o main main.for
Expected behavior (correct with gfortran):
(gdb) b 29
(gdb) r
(gdb) whatis string1
type = PTR TO -> ( character*(*) )
(gdb) p string1
$1 = (PTR TO -> ( character*(*) )) 0x0
(gdb) n
(gdb) p string1
$2 = (PTR TO -> ( character*(*) )) 0x55555555c680
(gdb) p *string1
$3 = '\000' <repeats 41 times>
----------------
Incorrect behavior (as experienced with ifort-generated executable):
(gdb) b 29
(gdb) r
(gdb) whatis string1
type = character*(*)
(gdb) p string1
Location address is not set.
(gdb) n
(gdb) whatis string1
type = character (0)
(gdb) p string1
$1 = ''
(gdb) n
(gdb) whatis string1
type = character (5053124857890819657)
(gdb) p string1
value requires 5053124857890819657 bytes, which is more than max-value-size
----------------
Based on the above, it looks like gdb is possibly not interpreting variables
with the ALLOCATABLE attribute as being a pointer, so any gdb operations on
that variable are going to be incorrect. And this seems to be limited to only
code generated with ifort; code generated with IFX and gfortran is correctly
interpreted. I am unable to test LLVM at this time.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug fortran/29842] Debugging variables with ALLOCATABLE attribute fails to read variable properties correctly
2022-12-02 18:45 [Bug fortran/29842] New: Debugging variables with ALLOCATABLE attribute fails to read variable properties correctly emr-gnu at hev dot psu.edu
@ 2022-12-05 19:01 ` emr-gnu at hev dot psu.edu
0 siblings, 0 replies; 2+ messages in thread
From: emr-gnu at hev dot psu.edu @ 2022-12-05 19:01 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=29842
--- Comment #1 from Eric Reischer <emr-gnu at hev dot psu.edu> ---
Additional information -- for the following variable definition, here is how
various compilers encode the DWARF-2 info:
INTEGER*4, ALLOCATABLE :: I(:)
ALLOCATE( I(30) )
---------------- ifort 2021.4.0 ----------------
< 2><0x0000004d> DW_TAG_variable
DW_AT_decl_line 0x00000003
DW_AT_decl_file 0x00000001 minimal.for
DW_AT_name i
DW_AT_type <0x00000061>
DW_AT_location len 0x0009:
03a0836b0000000000: DW_OP_addr 0x006b83a0
< 1><0x00000061> DW_TAG_array_type
DW_AT_ordering DW_ORD_col_major
DW_AT_type <0x00000093>
DW_AT_data_location len 0x0002: 9706:
DW_OP_push_object_address DW_OP_deref
DW_AT_allocated len 0x000b:
97101822060c010000001a: DW_OP_push_object_address DW_OP_constu 24 DW_OP_plus
DW_OP_deref DW_OP_const4u 1 DW_OP_and
< 2><0x00000076> DW_TAG_subrange_type
DW_AT_byte_stride len 0x0005: 9710382206:
DW_OP_push_object_address DW_OP_constu 56 DW_OP_plus DW_OP_deref
DW_AT_upper_bound len 0x000e:
971040220697103022062210011c: DW_OP_push_object_address DW_OP_constu 64
DW_OP_plus DW_OP_deref DW_OP_push_object_address DW_OP_constu 48 DW_OP_plus
DW_OP_deref DW_OP_plus DW_OP_constu 1 DW_OP_minus
DW_AT_lower_bound len 0x0005: 9710402206:
DW_OP_push_object_address DW_OP_constu 64 DW_OP_plus DW_OP_deref
< 1><0x00000093> DW_TAG_base_type
DW_AT_byte_size 0x00000004
DW_AT_encoding DW_ATE_signed
DW_AT_name INTEGER(4)
---------------- ifort 2021.4.0 ----------------
---------------- ifx 2021.4.0 ----------------
< 2><0x00000043> DW_TAG_variable
DW_AT_name i
DW_AT_type <0x0000005d>
DW_AT_decl_file 0x00000001 minimal.for
DW_AT_decl_line 0x00000003
DW_AT_location len 0x0009:
0390b36b0000000000: DW_OP_addr 0x006bb390
DW_AT_linkage_name test_$I
< 1><0x0000005d> DW_TAG_array_type
DW_AT_data_location len 0x0002: 9706:
DW_OP_push_object_address DW_OP_deref
DW_AT_allocated len 0x0006: 97231806311a:
DW_OP_push_object_address DW_OP_plus_uconst 24 DW_OP_deref DW_OP_lit1 DW_OP_and
DW_AT_type <0x00000088>
< 2><0x0000006c> DW_TAG_subrange_type
DW_AT_type <0x0000008f>
DW_AT_lower_bound len 0x0004: 97234006:
DW_OP_push_object_address DW_OP_plus_uconst 64 DW_OP_deref
DW_AT_upper_bound len 0x000b:
972340069723300622311c: DW_OP_push_object_address DW_OP_plus_uconst 64
DW_OP_deref DW_OP_push_object_address DW_OP_plus_uconst 48 DW_OP_deref
DW_OP_plus DW_OP_lit1 DW_OP_minus
DW_AT_byte_stride len 0x0004: 97233806:
DW_OP_push_object_address DW_OP_plus_uconst 56 DW_OP_deref
< 1><0x00000088> DW_TAG_base_type
DW_AT_name INTEGER*4
DW_AT_encoding DW_ATE_signed
DW_AT_byte_size 0x00000004
< 1><0x0000008f> DW_TAG_base_type
DW_AT_name __ARRAY_SIZE_TYPE__
DW_AT_byte_size 0x00000008
DW_AT_encoding DW_ATE_unsigned
---------------- ifx 2021.4.0 ----------------
---------------- gfortran 7.5.0 ----------------
< 1><0x0000007b> DW_TAG_base_type
DW_AT_byte_size 0x00000004
DW_AT_encoding DW_ATE_signed
DW_AT_name integer(kind=4)
< 1><0x00000087> DW_TAG_pointer_type
DW_AT_byte_size 0x00000008
DW_AT_type <0x0000008d>
< 2><0x000000b2> DW_TAG_variable
DW_AT_name i
DW_AT_decl_file 0x00000001 minimal.for
DW_AT_decl_line 0x00000003
DW_AT_type <0x000000d0>
DW_AT_location len 0x0002: 9140:
DW_OP_fbreg -64
< 1><0x000000d0> DW_TAG_array_type
DW_AT_data_location len 0x0002: 9706:
DW_OP_push_object_address DW_OP_deref
DW_AT_allocated len 0x0004: 9706302e:
DW_OP_push_object_address DW_OP_deref DW_OP_lit0 DW_OP_ne
DW_AT_type <0x0000007b>
< 2><0x000000dd> DW_TAG_subrange_type
DW_AT_lower_bound len 0x0004: 97232006:
DW_OP_push_object_address DW_OP_plus_uconst 32 DW_OP_deref
DW_AT_upper_bound len 0x0004: 97232806:
DW_OP_push_object_address DW_OP_plus_uconst 40 DW_OP_deref
DW_AT_byte_stride len 0x0006: 97231806341e:
DW_OP_push_object_address DW_OP_plus_uconst 24 DW_OP_deref DW_OP_lit4 DW_OP_mul
---------------- gfortran 7.5.0 ----------------
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-12-05 19:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-02 18:45 [Bug fortran/29842] New: Debugging variables with ALLOCATABLE attribute fails to read variable properties correctly emr-gnu at hev dot psu.edu
2022-12-05 19:01 ` [Bug fortran/29842] " emr-gnu at hev dot psu.edu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).