public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/29139] New: Emit pointer attribute when printing type of Fortran pointers
@ 2022-05-11 8:07 nils-christian.kempke at intel dot com
2022-05-11 8:07 ` [Bug fortran/29139] " nils-christian.kempke at intel dot com
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: nils-christian.kempke at intel dot com @ 2022-05-11 8:07 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=29139
Bug ID: 29139
Summary: Emit pointer attribute when printing type of Fortran
pointers
Product: gdb
Version: HEAD
Status: UNCONFIRMED
Severity: enhancement
Priority: P2
Component: fortran
Assignee: unassigned at sourceware dot org
Reporter: nils-christian.kempke at intel dot com
Target Milestone: ---
Currently, printing the type of a Fortran pointer (so an object with the
pointer attribute) and printing the type of an object of the same type without
the pointer attribute does not show any difference within GDB.
Consider the Fortran program
==============================================
program MAIN
Integer, target :: var
Integer, pointer :: pvar
pvar => var
var = 1
print *, var, pvar
end program
==============================================
compiled with
==============================================
>> gfortran --version
GNU Fortran (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
Copyright (C) 2019 Free Software Foundation, Inc.
==============================================
Running a GDB session and breaking at line 7 (the print statement) we get
==============================================
7 print *, var, pvar
(gdb) p pvar
$1 = (1, 1, 1)
(gdb) ptype pvar
type = integer(kind=4) (3)
(gdb) p var
$2 = (1, 1, 1)
(gdb) ptype var
type = integer(kind=4) (3)
(gdb) p associated(var)
ASSOCIATED can only be applied to pointers
(gdb) p associated(pvar)
$3 = .TRUE.
==============================================
The only way to find out if something is a pointer or not is via the Fortran
intrinsics. I think this could be improved and one could add the 'pointer'
attribute also to the type-print of pvar. The pointer attributed can be derived
from the emitted DWARF and the DW_AT_associated for the respective DIEs (as is
already done for the ASSOCIATED intrinsic)
In this case gfortran generates DWARF like:
==============================================
...
<2><ab>: Abbrev Number: 8 (DW_TAG_variable)
<ac> DW_AT_name : (indirect string, offset: 0x56): pvar
<b0> DW_AT_decl_file : 1
<b1> DW_AT_decl_line : 3
<b2> DW_AT_type : <0xca>
<b6> DW_AT_location : 3 byte block: 91 80 7f (DW_OP_fbreg: -128)
...
<1><ca>: Abbrev Number: 10 (DW_TAG_array_type)
<cb> DW_AT_data_location: 2 byte block: 97 6
(DW_OP_push_object_address; DW_OP_deref)
<ce> DW_AT_associated : 4 byte block: 97 6 30 2e
(DW_OP_push_object_address; DW_OP_deref; DW_OP_lit0; DW_OP_ne)
<d3> DW_AT_type : <0x74>
<d7> DW_AT_sibling : <0xf1>
...
==============================================
with the additional DW_AT_associated attribute.
Something like
==============================================
(gdb) p pvar
type = interger(kind=4) (3) pointer
==============================================
would give more insight here.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug fortran/29139] Emit pointer attribute when printing type of Fortran pointers
2022-05-11 8:07 [Bug fortran/29139] New: Emit pointer attribute when printing type of Fortran pointers nils-christian.kempke at intel dot com
@ 2022-05-11 8:07 ` nils-christian.kempke at intel dot com
2022-05-11 8:11 ` nils-christian.kempke at intel dot com
2023-10-18 18:46 ` levraiphilippeblain at gmail dot com
2 siblings, 0 replies; 4+ messages in thread
From: nils-christian.kempke at intel dot com @ 2022-05-11 8:07 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=29139
Kempke, Nils-Christian <nils-christian.kempke at intel dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P2 |P3
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug fortran/29139] Emit pointer attribute when printing type of Fortran pointers
2022-05-11 8:07 [Bug fortran/29139] New: Emit pointer attribute when printing type of Fortran pointers nils-christian.kempke at intel dot com
2022-05-11 8:07 ` [Bug fortran/29139] " nils-christian.kempke at intel dot com
@ 2022-05-11 8:11 ` nils-christian.kempke at intel dot com
2023-10-18 18:46 ` levraiphilippeblain at gmail dot com
2 siblings, 0 replies; 4+ messages in thread
From: nils-christian.kempke at intel dot com @ 2022-05-11 8:11 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=29139
--- Comment #1 from Kempke, Nils-Christian <nils-christian.kempke at intel dot com> ---
I meant
==============================================
(gdb) ptype pvar
type = interger(kind=4) (3) pointer
==============================================
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug fortran/29139] Emit pointer attribute when printing type of Fortran pointers
2022-05-11 8:07 [Bug fortran/29139] New: Emit pointer attribute when printing type of Fortran pointers nils-christian.kempke at intel dot com
2022-05-11 8:07 ` [Bug fortran/29139] " nils-christian.kempke at intel dot com
2022-05-11 8:11 ` nils-christian.kempke at intel dot com
@ 2023-10-18 18:46 ` levraiphilippeblain at gmail dot com
2 siblings, 0 replies; 4+ messages in thread
From: levraiphilippeblain at gmail dot com @ 2023-10-18 18:46 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=29139
Philippe Blain <levraiphilippeblain at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |levraiphilippeblain at gmail dot c
| |om
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-10-18 18:46 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-11 8:07 [Bug fortran/29139] New: Emit pointer attribute when printing type of Fortran pointers nils-christian.kempke at intel dot com
2022-05-11 8:07 ` [Bug fortran/29139] " nils-christian.kempke at intel dot com
2022-05-11 8:11 ` nils-christian.kempke at intel dot com
2023-10-18 18:46 ` levraiphilippeblain at gmail dot com
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).