public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "nils-christian.kempke at intel dot com" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug fortran/22497] Unable to access base type of derived types
Date: Fri, 08 Apr 2022 14:14:25 +0000	[thread overview]
Message-ID: <bug-22497-4717-ggilOoztgq@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-22497-4717@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=22497

Kempke, Nils-Christian <nils-christian.kempke at intel dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nils-christian.kempke@intel
                   |                            |.com

--- Comment #1 from Kempke, Nils-Christian <nils-christian.kempke at intel dot com> ---
I can confirm that this was a bug in GDB but now actually only is one in
gfortran. I recently pushed 

87e10e9c288c2f6c933f235b623522c8d9a2d727

and

110aae55a8b7e19fa5f04998851968e48822605f

which fixed this problem on GDB's side. The problem with gfortran is, that it
is not emitting the correct DWARF OOP Fortran tags.

This is a known issue here: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=49475

Compiling the example with the ifort or ifx compiler I can get the following
out of gdb (breaking at line 17):

=================================================================
(gdb) p foo
$1 = ( my_int = 0 )
(gdb) p bar
$2 = ( my_type = ( my_int = 1 ) )
(gdb) ptype foo
type = Type my_type
    INTEGER*4 :: my_int
End Type my_type
(gdb) ptype bar
type = Type, extends(my_type) :: extended_type
    Type my_type :: my_type
End Type extended_type
(gdb) p bar%my_type
$3 = ( my_int = 1 )
(gdb) p bar%my_int
$4 = 1
(gdb) p bar%my_type%my_int
$5 = 1
(gdb)
=================================================================

The types emitted by gfortran (GNU Fortran (Ubuntu 9.3.0-17ubuntu1~20.04)
9.3.0) do not provide any inheritance information:

=================================================================
 <1><53>: Abbrev Number: 2 (DW_TAG_structure_type)
    <54>   DW_AT_name        : (indirect string, offset: 0x8): extended_type
    <58>   DW_AT_byte_size   : 4
    <59>   DW_AT_decl_file   : 1
    <5a>   DW_AT_decl_line   : 1
    <5b>   DW_AT_sibling     : <0x6c>
 <2><5f>: Abbrev Number: 3 (DW_TAG_member)
    <60>   DW_AT_name        : (indirect string, offset: 0x0): my_type
    <64>   DW_AT_decl_file   : 1
    <65>   DW_AT_decl_line   : 8
    <66>   DW_AT_type        : <0x2e>
    <6a>   DW_AT_data_member_location: 0
 <2><6b>: Abbrev Number: 0
=================================================================

while ifx/ifort emit
=================================================================
 <2><5c>: Abbrev Number: 4 (DW_TAG_structure_type)
    <5d>   DW_AT_name        : (indirect string, offset: 0x3b): extended_type
    <61>   DW_AT_byte_size   : 4
    <62>   DW_AT_decl_file   : 1
    <63>   DW_AT_decl_line   : 8
 <3><64>: Abbrev Number: 5 (DW_TAG_inheritance)
    <65>   DW_AT_type        : <0x83>
 <3><69>: Abbrev Number: 0
...
 <2><83>: Abbrev Number: 4 (DW_TAG_structure_type)
    <84>   DW_AT_name        : (indirect string, offset: 0x68): my_type
    <88>   DW_AT_byte_size   : 4
    <89>   DW_AT_decl_file   : 1
    <8a>   DW_AT_decl_line   : 4
 <3><8b>: Abbrev Number: 6 (DW_TAG_member)
    <8c>   DW_AT_name        : (indirect string, offset: 0x57): my_int
    <90>   DW_AT_type        : <0x9a>
    <94>   DW_AT_decl_file   : 1
    <95>   DW_AT_decl_line   : 4
    <96>   DW_AT_data_member_location: 0
    <97>   DW_AT_accessibility: 1       (public)
 <3><98>: Abbrev Number: 0
=================================================================

-- 
You are receiving this mail because:
You are on the CC list for the bug.

       reply	other threads:[~2022-04-08 14:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-22497-4717@http.sourceware.org/bugzilla/>
2022-04-08 14:14 ` nils-christian.kempke at intel dot com [this message]
2022-04-08 14:24 ` nils-christian.kempke at intel dot com
2023-03-07 14:20 ` tromey at sourceware dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-22497-4717-ggilOoztgq@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).